mirror of
https://github.com/pretix/pretix.git
synced 2026-05-08 15:44:02 +00:00
Use consistent flake8 settings everywhere and fix flake8 issues
This commit is contained in:
@@ -6,7 +6,6 @@ from django.dispatch import receiver
|
||||
from django.utils.translation import ugettext as _
|
||||
|
||||
from ..exporter import BaseExporter
|
||||
from ..models import Invoice
|
||||
from ..signals import register_data_exporters
|
||||
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ class JSONExporter(BaseExporter):
|
||||
'id': category.id,
|
||||
'name': str(category.name)
|
||||
} for category in self.event.categories.all()
|
||||
],
|
||||
],
|
||||
'items': [
|
||||
{
|
||||
'id': item.id,
|
||||
@@ -43,16 +43,16 @@ class JSONExporter(BaseExporter):
|
||||
item.default_price,
|
||||
'name': str(variation)
|
||||
} for variation in item.variations.all()
|
||||
]
|
||||
]
|
||||
} for item in self.event.items.all().prefetch_related('variations')
|
||||
],
|
||||
],
|
||||
'questions': [
|
||||
{
|
||||
'id': question.id,
|
||||
'question': str(question.question),
|
||||
'type': question.type
|
||||
} for question in self.event.questions.all()
|
||||
],
|
||||
],
|
||||
'orders': [
|
||||
{
|
||||
'code': order.code,
|
||||
@@ -74,12 +74,12 @@ class JSONExporter(BaseExporter):
|
||||
'question': answer.question_id,
|
||||
'answer': answer.answer
|
||||
} for answer in position.answers.all()
|
||||
]
|
||||
]
|
||||
} for position in order.positions.all()
|
||||
]
|
||||
]
|
||||
} for order in
|
||||
self.event.orders.all().prefetch_related('positions', 'positions__answers')
|
||||
],
|
||||
],
|
||||
'quotas': [
|
||||
{
|
||||
'id': quota.id,
|
||||
@@ -87,7 +87,7 @@ class JSONExporter(BaseExporter):
|
||||
'items': [item.id for item in quota.items.all()],
|
||||
'variations': [variation.id for variation in quota.variations.all()],
|
||||
} for quota in self.event.quotas.all().prefetch_related('items', 'variations')
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import csv
|
||||
import io
|
||||
import json
|
||||
from collections import OrderedDict
|
||||
|
||||
from django import forms
|
||||
|
||||
@@ -3,7 +3,6 @@ from datetime import date
|
||||
from decimal import Decimal
|
||||
|
||||
from django.db import DatabaseError, models, transaction
|
||||
from django.db.models import Max
|
||||
from django.utils.crypto import get_random_string
|
||||
from django.utils.functional import cached_property
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ from django.utils.translation import ugettext_lazy as _
|
||||
from .base import LoggedModel
|
||||
from .event import Event
|
||||
from .items import Item, ItemVariation, Quota
|
||||
from .orders import CartPosition, Order, OrderPosition
|
||||
from .orders import CartPosition
|
||||
|
||||
|
||||
def _generate_random_code():
|
||||
|
||||
@@ -8,7 +8,7 @@ from django.utils.translation import ugettext as _
|
||||
|
||||
from pretix.base.i18n import LazyLocaleException
|
||||
from pretix.base.models import (
|
||||
CartPosition, Event, EventLock, Item, ItemVariation, Quota, Voucher,
|
||||
CartPosition, Event, Item, ItemVariation, Quota, Voucher,
|
||||
)
|
||||
from pretix.base.services.locking import LockTimeoutException
|
||||
from pretix.celery import app
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
from typing import Any, Dict
|
||||
|
||||
from django.conf import settings
|
||||
from django.core.files.base import ContentFile
|
||||
|
||||
from pretix.base.models import CachedFile, Event, cachedfile_name
|
||||
|
||||
@@ -5,7 +5,6 @@ from datetime import date
|
||||
from decimal import Decimal
|
||||
from locale import format as lformat
|
||||
|
||||
from django.conf import settings
|
||||
from django.contrib.staticfiles import finders
|
||||
from django.core.files.base import ContentFile
|
||||
from django.db import transaction
|
||||
|
||||
@@ -15,7 +15,7 @@ from pretix.base.i18n import (
|
||||
LazyDate, LazyLocaleException, LazyNumber, language,
|
||||
)
|
||||
from pretix.base.models import (
|
||||
CartPosition, Event, EventLock, Item, ItemVariation, Order, OrderPosition,
|
||||
CartPosition, Event, Item, ItemVariation, Order, OrderPosition,
|
||||
Quota, User,
|
||||
)
|
||||
from pretix.base.models.orders import InvoiceAddress
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import os
|
||||
|
||||
from django.http import FileResponse, HttpRequest, HttpResponse
|
||||
from django.shortcuts import get_object_or_404, redirect
|
||||
from django.shortcuts import get_object_or_404
|
||||
from django.utils.functional import cached_property
|
||||
from django.views.generic import TemplateView
|
||||
|
||||
|
||||
@@ -336,7 +336,7 @@ class MailSettings(EventSettingsFormView):
|
||||
self.request.event.log_action(
|
||||
'pretix.event.settings', user=self.request.user, data={
|
||||
k: form.cleaned_data.get(k) for k in form.changed_data
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
if request.POST.get('test', '0').strip() == '1':
|
||||
|
||||
@@ -13,7 +13,7 @@ from django.views.generic import DetailView, ListView, TemplateView, View
|
||||
|
||||
from pretix.base.i18n import language
|
||||
from pretix.base.models import (
|
||||
CachedFile, CachedTicket, EventLock, Invoice, Item, ItemVariation, Order,
|
||||
CachedFile, CachedTicket, Invoice, Item, ItemVariation, Order,
|
||||
Quota,
|
||||
)
|
||||
from pretix.base.services import tickets
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import json
|
||||
from collections import OrderedDict
|
||||
|
||||
from django import forms
|
||||
from django.template.loader import get_template
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ from django.shortcuts import get_object_or_404, redirect, render
|
||||
from django.utils.functional import cached_property
|
||||
from django.utils.timezone import now
|
||||
from django.utils.translation import ugettext as _
|
||||
from django.views.generic import DetailView, ListView, TemplateView, View
|
||||
from django.views.generic import DetailView, ListView, View
|
||||
|
||||
from pretix.base.models import Order, Quota
|
||||
from pretix.base.services.mail import SendMailException
|
||||
@@ -283,7 +283,7 @@ class ImportView(EventPermissionRequiredMixin, ListView):
|
||||
[
|
||||
self.request.POST.get('col[%d][%d]' % (i, j))
|
||||
for j in range(int(self.request.POST.get('cols')))
|
||||
]
|
||||
]
|
||||
)
|
||||
if 'reference' not in self.request.POST:
|
||||
messages.error(self.request, _('You need to select the column containing the payment reference.'))
|
||||
|
||||
@@ -6,7 +6,7 @@ from django.http import HttpResponse
|
||||
from django.views.decorators.csrf import csrf_exempt
|
||||
from django.views.decorators.http import require_POST
|
||||
|
||||
from pretix.base.models import Event, Order
|
||||
from pretix.base.models import Order
|
||||
from pretix.base.services.orders import mark_order_refunded
|
||||
from pretix.plugins.stripe.payment import Stripe
|
||||
from pretix.presale.utils import event_view
|
||||
|
||||
@@ -182,7 +182,7 @@ INSTALLED_APPS = [
|
||||
]
|
||||
|
||||
try:
|
||||
import django_extensions
|
||||
import django_extensions # noqa
|
||||
INSTALLED_APPS.append('django_extensions')
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user