mirror of
https://github.com/pretix/pretix.git
synced 2026-05-05 15:14:04 +00:00
Upgrade to Django 3.0 and other dependencies (#1568)
* Upgrade Django to 3.0 and other dependencies to recent versions * Fix otp version contsraint * Remove six dependency * Resolve some warnings * Fix failing tests * Update django-countries * Resolve all RemovedInDjango31Warnings in test suite * Run isort * Fix import * Update PostgreSQL version on travis
This commit is contained in:
@@ -6,7 +6,7 @@ from django.conf import settings
|
||||
from django.core.exceptions import ValidationError
|
||||
from django.core.files import File
|
||||
from django.forms.utils import from_current_timezone
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
from ...base.forms import I18nModelForm
|
||||
# Import for backwards compatibility with okd import paths
|
||||
|
||||
@@ -10,7 +10,7 @@ from django.urls import reverse
|
||||
from django.utils.html import escape
|
||||
from django.utils.safestring import mark_safe
|
||||
from django.utils.timezone import get_current_timezone_name
|
||||
from django.utils.translation import pgettext_lazy, ugettext_lazy as _
|
||||
from django.utils.translation import gettext_lazy as _, pgettext_lazy
|
||||
from django_countries import Countries
|
||||
from django_countries.fields import LazyTypedChoiceField
|
||||
from i18nfield.forms import (
|
||||
|
||||
@@ -8,7 +8,7 @@ from django.db.models.functions import Coalesce, ExtractWeekDay
|
||||
from django.urls import reverse, reverse_lazy
|
||||
from django.utils.functional import cached_property
|
||||
from django.utils.timezone import get_current_timezone, make_aware, now
|
||||
from django.utils.translation import pgettext_lazy, ugettext_lazy as _
|
||||
from django.utils.translation import gettext_lazy as _, pgettext_lazy
|
||||
|
||||
from pretix.base.forms.widgets import DatePickerWidget
|
||||
from pretix.base.models import (
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
from collections import OrderedDict
|
||||
|
||||
from django import forms
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
from i18nfield.forms import I18nFormField, I18nTextarea, I18nTextInput
|
||||
|
||||
from pretix.base.forms import SettingsForm
|
||||
|
||||
@@ -7,7 +7,7 @@ from django.db.models import Max
|
||||
from django.forms.formsets import DELETION_FIELD_NAME
|
||||
from django.urls import reverse
|
||||
from django.utils.translation import (
|
||||
pgettext_lazy, ugettext as __, ugettext_lazy as _,
|
||||
gettext as __, gettext_lazy as _, pgettext_lazy,
|
||||
)
|
||||
from django_scopes.forms import (
|
||||
SafeModelChoiceField, SafeModelMultipleChoiceField,
|
||||
|
||||
@@ -8,7 +8,7 @@ from django.db import models
|
||||
from django.urls import reverse
|
||||
from django.utils.timezone import make_aware, now
|
||||
from django.utils.translation import (
|
||||
gettext_noop, pgettext_lazy, ugettext_lazy as _,
|
||||
gettext_lazy as _, gettext_noop, pgettext_lazy,
|
||||
)
|
||||
from i18nfield.forms import I18nFormField, I18nTextarea, I18nTextInput
|
||||
from i18nfield.strings import LazyI18nString
|
||||
|
||||
@@ -7,7 +7,7 @@ from django.core.exceptions import ValidationError
|
||||
from django.core.validators import RegexValidator
|
||||
from django.db.models import Q
|
||||
from django.utils.safestring import mark_safe
|
||||
from django.utils.translation import pgettext_lazy, ugettext_lazy as _
|
||||
from django.utils.translation import gettext_lazy as _, pgettext_lazy
|
||||
from django_scopes.forms import SafeModelMultipleChoiceField
|
||||
from i18nfield.forms import I18nFormField, I18nTextarea
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ from django.urls import reverse
|
||||
from django.utils.dates import MONTHS, WEEKDAYS
|
||||
from django.utils.functional import cached_property
|
||||
from django.utils.timezone import now
|
||||
from django.utils.translation import pgettext_lazy, ugettext_lazy as _
|
||||
from django.utils.translation import gettext_lazy as _, pgettext_lazy
|
||||
from i18nfield.forms import I18nInlineFormSet
|
||||
|
||||
from pretix.base.forms import I18nModelForm
|
||||
|
||||
@@ -4,7 +4,7 @@ from django.contrib.auth.password_validation import (
|
||||
password_validators_help_texts, validate_password,
|
||||
)
|
||||
from django.db.models import Q
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
from pytz import common_timezones
|
||||
|
||||
from pretix.base.models import User
|
||||
|
||||
@@ -7,7 +7,7 @@ from django.core.exceptions import ObjectDoesNotExist, ValidationError
|
||||
from django.core.validators import EmailValidator
|
||||
from django.db.models.functions import Lower
|
||||
from django.urls import reverse
|
||||
from django.utils.translation import pgettext_lazy, ugettext_lazy as _
|
||||
from django.utils.translation import gettext_lazy as _, pgettext_lazy
|
||||
from django_scopes.forms import SafeModelChoiceField
|
||||
|
||||
from pretix.base.email import get_available_placeholders
|
||||
|
||||
@@ -10,7 +10,7 @@ from django.urls import reverse
|
||||
from django.utils.formats import date_format
|
||||
from django.utils.html import escape
|
||||
from django.utils.safestring import mark_safe
|
||||
from django.utils.translation import pgettext_lazy, ugettext_lazy as _
|
||||
from django.utils.translation import gettext_lazy as _, pgettext_lazy
|
||||
from i18nfield.strings import LazyI18nString
|
||||
|
||||
from pretix.base.models import (
|
||||
|
||||
@@ -7,7 +7,7 @@ from django.shortcuts import get_object_or_404, redirect, resolve_url
|
||||
from django.template.response import TemplateResponse
|
||||
from django.urls import get_script_prefix, resolve, reverse
|
||||
from django.utils.encoding import force_str
|
||||
from django.utils.translation import ugettext as _
|
||||
from django.utils.translation import gettext as _
|
||||
from django_scopes import scope
|
||||
from hijack.templatetags.hijack_tags import is_hijacked
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from django.http import HttpRequest
|
||||
from django.urls import reverse
|
||||
from django.utils.translation import pgettext_lazy, ugettext_lazy as _
|
||||
from django.utils.translation import gettext_lazy as _, pgettext_lazy
|
||||
|
||||
from pretix.control.signals import (
|
||||
nav_event, nav_event_settings, nav_global, nav_organizer,
|
||||
|
||||
@@ -3,7 +3,7 @@ from urllib.parse import quote
|
||||
from django.core.exceptions import PermissionDenied
|
||||
from django.shortcuts import redirect
|
||||
from django.urls import reverse
|
||||
from django.utils.translation import ugettext as _
|
||||
from django.utils.translation import gettext as _
|
||||
|
||||
|
||||
def event_permission_required(permission):
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from django import template
|
||||
from django.template import Node
|
||||
from django.utils.translation import ugettext as _
|
||||
from django.utils.translation import gettext as _
|
||||
|
||||
from pretix.base.models import Event
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import warnings
|
||||
from django.core.paginator import (
|
||||
EmptyPage, PageNotAnInteger, UnorderedObjectListWarning,
|
||||
)
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
from django.views.generic import edit
|
||||
|
||||
|
||||
|
||||
@@ -15,8 +15,8 @@ from django.db import transaction
|
||||
from django.shortcuts import redirect, render
|
||||
from django.urls import reverse
|
||||
from django.utils.functional import cached_property
|
||||
from django.utils.http import is_safe_url
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.utils.http import url_has_allowed_host_and_scheme
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
from django.views.generic import TemplateView
|
||||
from django_otp import match_token
|
||||
|
||||
@@ -44,13 +44,13 @@ def process_login(request, user, keep_logged_in):
|
||||
request.session['pretix_auth_2fa_user'] = user.pk
|
||||
request.session['pretix_auth_2fa_time'] = str(int(time.time()))
|
||||
twofa_url = reverse('control:auth.login.2fa')
|
||||
if next_url and is_safe_url(next_url, allowed_hosts=None):
|
||||
if next_url and url_has_allowed_host_and_scheme(next_url, allowed_hosts=None):
|
||||
twofa_url += '?next=' + quote(next_url)
|
||||
return redirect(twofa_url)
|
||||
else:
|
||||
auth_login(request, user)
|
||||
request.session['pretix_auth_login_time'] = int(time.time())
|
||||
if next_url and is_safe_url(next_url, allowed_hosts=None):
|
||||
if next_url and url_has_allowed_host_and_scheme(next_url, allowed_hosts=None):
|
||||
return redirect(next_url)
|
||||
return redirect(reverse('control:index'))
|
||||
|
||||
@@ -96,9 +96,9 @@ def logout(request):
|
||||
auth_logout(request)
|
||||
request.session['pretix_auth_login_time'] = 0
|
||||
next = reverse('control:auth.login')
|
||||
if 'next' in request.GET and is_safe_url(request.GET.get('next'), allowed_hosts=None):
|
||||
if 'next' in request.GET and url_has_allowed_host_and_scheme(request.GET.get('next'), allowed_hosts=None):
|
||||
next += '?next=' + quote(request.GET.get('next'))
|
||||
if 'back' in request.GET and is_safe_url(request.GET.get('back'), allowed_hosts=None):
|
||||
if 'back' in request.GET and url_has_allowed_host_and_scheme(request.GET.get('back'), allowed_hosts=None):
|
||||
return redirect(request.GET.get('back'))
|
||||
return redirect(next)
|
||||
|
||||
@@ -405,7 +405,7 @@ class Login2FAView(TemplateView):
|
||||
request.session['pretix_auth_login_time'] = int(time.time())
|
||||
del request.session['pretix_auth_2fa_user']
|
||||
del request.session['pretix_auth_2fa_time']
|
||||
if "next" in request.GET and is_safe_url(request.GET.get("next"), allowed_hosts=None):
|
||||
if "next" in request.GET and url_has_allowed_host_and_scheme(request.GET.get("next"), allowed_hosts=None):
|
||||
return redirect(request.GET.get("next"))
|
||||
return redirect(reverse('control:index'))
|
||||
else:
|
||||
|
||||
@@ -7,7 +7,7 @@ from django.shortcuts import get_object_or_404, redirect
|
||||
from django.urls import reverse
|
||||
from django.utils.functional import cached_property
|
||||
from django.utils.timezone import is_aware, make_aware, now
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
from django.views.generic import DeleteView, ListView
|
||||
from pytz import UTC
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ from django.utils import formats
|
||||
from django.utils.formats import date_format
|
||||
from django.utils.html import escape
|
||||
from django.utils.timezone import now
|
||||
from django.utils.translation import pgettext, ugettext_lazy as _, ungettext
|
||||
from django.utils.translation import gettext_lazy as _, pgettext, ungettext
|
||||
|
||||
from pretix.base.decimal import round_decimal
|
||||
from pretix.base.models import (
|
||||
|
||||
@@ -21,7 +21,7 @@ from django.urls import reverse
|
||||
from django.utils import translation
|
||||
from django.utils.functional import cached_property
|
||||
from django.utils.timezone import now
|
||||
from django.utils.translation import ugettext, ugettext_lazy as _
|
||||
from django.utils.translation import gettext, gettext_lazy as _
|
||||
from django.views.generic import DeleteView, FormView, ListView
|
||||
from django.views.generic.base import TemplateView, View
|
||||
from django.views.generic.detail import SingleObjectMixin
|
||||
@@ -667,14 +667,14 @@ class MailSettingsRendererPreview(MailSettingsPreview):
|
||||
with rolledback_transaction():
|
||||
order = request.event.orders.create(status=Order.STATUS_PENDING, datetime=now(),
|
||||
expires=now(), code="PREVIEW", total=119)
|
||||
item = request.event.items.create(name=ugettext("Sample product"), default_price=42.23,
|
||||
description=ugettext("Sample product description"))
|
||||
p = order.positions.create(item=item, attendee_name_parts={'_legacy': ugettext("John Doe")},
|
||||
item = request.event.items.create(name=gettext("Sample product"), default_price=42.23,
|
||||
description=gettext("Sample product description"))
|
||||
p = order.positions.create(item=item, attendee_name_parts={'_legacy': gettext("John Doe")},
|
||||
price=item.default_price)
|
||||
v = renderers[request.GET.get('renderer')].render(
|
||||
v,
|
||||
str(request.event.settings.mail_text_signature),
|
||||
ugettext('Your order: %(code)s') % {'code': order.code},
|
||||
gettext('Your order: %(code)s') % {'code': order.code},
|
||||
order,
|
||||
position=p
|
||||
)
|
||||
@@ -1058,7 +1058,7 @@ class TaxCreate(EventSettingsViewMixin, EventPermissionRequiredMixin, CreateView
|
||||
|
||||
def get_initial(self):
|
||||
return {
|
||||
'name': LazyI18nString.from_gettext(ugettext('VAT'))
|
||||
'name': LazyI18nString.from_gettext(gettext('VAT'))
|
||||
}
|
||||
|
||||
def post(self, request, *args, **kwargs):
|
||||
@@ -1317,9 +1317,9 @@ class QuickSetupView(FormView):
|
||||
tax_rule = self.request.event.tax_rules.first()
|
||||
if any(f not in self.formset.deleted_forms for f in self.formset):
|
||||
category = self.request.event.categories.create(
|
||||
name=LazyI18nString.from_gettext(ugettext('Tickets'))
|
||||
name=LazyI18nString.from_gettext(gettext('Tickets'))
|
||||
)
|
||||
category.log_action('pretix.event.category.added', data={'name': ugettext('Tickets')},
|
||||
category.log_action('pretix.event.category.added', data={'name': gettext('Tickets')},
|
||||
user=self.request.user)
|
||||
|
||||
subevent = self.request.event.subevents.first()
|
||||
@@ -1350,12 +1350,12 @@ class QuickSetupView(FormView):
|
||||
|
||||
if form.cleaned_data['total_quota']:
|
||||
quota = self.request.event.quotas.create(
|
||||
name=ugettext('Tickets'),
|
||||
name=gettext('Tickets'),
|
||||
size=form.cleaned_data['total_quota'],
|
||||
subevent=subevent,
|
||||
)
|
||||
quota.log_action('pretix.event.quota.added', user=self.request.user, data={
|
||||
'name': ugettext('Tickets'),
|
||||
'name': gettext('Tickets'),
|
||||
'size': quota.size
|
||||
})
|
||||
quota.items.add(*items)
|
||||
@@ -1381,12 +1381,12 @@ class QuickSetupView(FormView):
|
||||
event=self.request.event,
|
||||
initial=[
|
||||
{
|
||||
'name': LazyI18nString.from_gettext(ugettext('Regular ticket')),
|
||||
'name': LazyI18nString.from_gettext(gettext('Regular ticket')),
|
||||
'default_price': Decimal('35.00'),
|
||||
'quota': 100,
|
||||
},
|
||||
{
|
||||
'name': LazyI18nString.from_gettext(ugettext('Reduced ticket')),
|
||||
'name': LazyI18nString.from_gettext(gettext('Reduced ticket')),
|
||||
'default_price': Decimal('29.00'),
|
||||
'quota': 50,
|
||||
},
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
from django.contrib import messages
|
||||
from django.http import JsonResponse
|
||||
from django.shortcuts import get_object_or_404, redirect, reverse
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
from django.views import View
|
||||
from django.views.generic import FormView, TemplateView
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ from django.shortcuts import redirect
|
||||
from django.urls import resolve, reverse
|
||||
from django.utils.functional import cached_property
|
||||
from django.utils.timezone import now
|
||||
from django.utils.translation import ugettext, ugettext_lazy as _
|
||||
from django.utils.translation import gettext, gettext_lazy as _
|
||||
from django.views.generic import ListView
|
||||
from django.views.generic.detail import DetailView, SingleObjectMixin
|
||||
from django.views.generic.edit import DeleteView
|
||||
@@ -499,7 +499,7 @@ class QuestionView(EventPermissionRequiredMixin, QuestionMixin, ChartContainingV
|
||||
if self.object.type == Question.TYPE_FILE:
|
||||
qs = [
|
||||
{
|
||||
'answer': ugettext('File uploaded'),
|
||||
'answer': gettext('File uploaded'),
|
||||
'count': qs.filter(file__isnull=False).count(),
|
||||
}
|
||||
]
|
||||
@@ -523,7 +523,7 @@ class QuestionView(EventPermissionRequiredMixin, QuestionMixin, ChartContainingV
|
||||
if self.object.type == Question.TYPE_BOOLEAN:
|
||||
for a in qs:
|
||||
a['alink'] = a['answer']
|
||||
a['answer'] = ugettext('Yes') if a['answer'] == 'True' else ugettext('No')
|
||||
a['answer'] = gettext('Yes') if a['answer'] == 'True' else gettext('No')
|
||||
a['answer_bool'] = a['answer'] == 'True'
|
||||
elif self.object.type == Question.TYPE_COUNTRYCODE:
|
||||
for a in qs:
|
||||
@@ -724,45 +724,45 @@ class QuotaView(ChartContainingView, DetailView):
|
||||
|
||||
data = [
|
||||
{
|
||||
'label': ugettext('Paid orders'),
|
||||
'label': gettext('Paid orders'),
|
||||
'value': self.object.count_paid_orders(),
|
||||
'sum': True,
|
||||
},
|
||||
{
|
||||
'label': ugettext('Pending orders'),
|
||||
'label': gettext('Pending orders'),
|
||||
'value': self.object.count_pending_orders(),
|
||||
'sum': True,
|
||||
},
|
||||
{
|
||||
'label': ugettext('Vouchers and waiting list reservations'),
|
||||
'label': gettext('Vouchers and waiting list reservations'),
|
||||
'value': self.object.count_blocking_vouchers(),
|
||||
'sum': True,
|
||||
},
|
||||
{
|
||||
'label': ugettext('Current user\'s carts'),
|
||||
'label': gettext('Current user\'s carts'),
|
||||
'value': self.object.count_in_cart(),
|
||||
'sum': True,
|
||||
},
|
||||
]
|
||||
|
||||
sum_values = sum([d['value'] for d in data if d['sum']])
|
||||
s = self.object.size - sum_values if self.object.size is not None else ugettext('Infinite')
|
||||
s = self.object.size - sum_values if self.object.size is not None else gettext('Infinite')
|
||||
|
||||
data.append({
|
||||
'label': ugettext('Available quota'),
|
||||
'label': gettext('Available quota'),
|
||||
'value': s,
|
||||
'sum': False,
|
||||
'strong': True
|
||||
})
|
||||
data.append({
|
||||
'label': ugettext('Waiting list (pending)'),
|
||||
'label': gettext('Waiting list (pending)'),
|
||||
'value': self.object.count_waiting_list_pending(),
|
||||
'sum': False,
|
||||
})
|
||||
|
||||
if self.object.size is not None:
|
||||
data.append({
|
||||
'label': ugettext('Currently for sale'),
|
||||
'label': gettext('Currently for sale'),
|
||||
'value': avail[1],
|
||||
'sum': False,
|
||||
'strong': True
|
||||
|
||||
@@ -10,7 +10,7 @@ from django.shortcuts import redirect
|
||||
from django.urls import reverse
|
||||
from django.utils.crypto import get_random_string
|
||||
from django.utils.functional import cached_property
|
||||
from django.utils.translation import ugettext, ugettext_lazy as _
|
||||
from django.utils.translation import gettext, gettext_lazy as _
|
||||
from django.views import View
|
||||
from django.views.generic import ListView
|
||||
from i18nfield.strings import LazyI18nString
|
||||
@@ -284,7 +284,7 @@ class EventWizard(SafeSessionWizardView):
|
||||
if basics_data['tax_rate']:
|
||||
if not event.settings.tax_rate_default or event.settings.tax_rate_default.rate != basics_data['tax_rate']:
|
||||
event.settings.tax_rate_default = event.tax_rules.create(
|
||||
name=LazyI18nString.from_gettext(ugettext('VAT')),
|
||||
name=LazyI18nString.from_gettext(gettext('VAT')),
|
||||
rate=basics_data['tax_rate']
|
||||
)
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ from django.contrib import messages
|
||||
from django.http import HttpResponseRedirect
|
||||
from django.shortcuts import redirect
|
||||
from django.urls import reverse_lazy
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
from django.views.generic import DetailView, ListView
|
||||
from oauth2_provider.generators import generate_client_secret
|
||||
from oauth2_provider.models import get_application_model
|
||||
|
||||
@@ -7,7 +7,7 @@ from django.shortcuts import get_object_or_404, redirect
|
||||
from django.urls import reverse
|
||||
from django.utils.functional import cached_property
|
||||
from django.utils.timezone import now
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
from django.views.generic import FormView, TemplateView
|
||||
|
||||
from pretix.base.models import CachedFile
|
||||
|
||||
@@ -26,7 +26,7 @@ from django.utils import formats
|
||||
from django.utils.functional import cached_property
|
||||
from django.utils.http import is_safe_url
|
||||
from django.utils.timezone import make_aware, now
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
from django.views.generic import (
|
||||
DetailView, FormView, ListView, TemplateView, View,
|
||||
)
|
||||
|
||||
@@ -16,7 +16,7 @@ from django.http import JsonResponse
|
||||
from django.shortcuts import get_object_or_404, redirect
|
||||
from django.urls import reverse
|
||||
from django.utils.functional import cached_property
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
from django.views import View
|
||||
from django.views.generic import (
|
||||
CreateView, DeleteView, DetailView, FormView, ListView, UpdateView,
|
||||
@@ -935,7 +935,7 @@ class GiftCardListView(OrganizerDetailViewMixin, OrganizerPermissionRequiredMixi
|
||||
def get_queryset(self):
|
||||
qs = self.request.organizer.issued_gift_cards.annotate(
|
||||
cached_value=Coalesce(Sum('transactions__value'), Decimal('0.00'))
|
||||
)
|
||||
).order_by('-issuance')
|
||||
if self.filter_form.is_valid():
|
||||
qs = self.filter_form.filter_qs(qs)
|
||||
return qs
|
||||
|
||||
@@ -15,7 +15,7 @@ from django.shortcuts import get_object_or_404
|
||||
from django.urls import reverse
|
||||
from django.utils.crypto import get_random_string
|
||||
from django.utils.timezone import now
|
||||
from django.utils.translation import ugettext as _
|
||||
from django.utils.translation import gettext as _
|
||||
from django.views.generic import TemplateView
|
||||
from PyPDF2 import PdfFileWriter
|
||||
from reportlab.lib.units import mm
|
||||
|
||||
@@ -4,7 +4,7 @@ from collections import OrderedDict
|
||||
from django.shortcuts import get_object_or_404
|
||||
from django.urls import reverse
|
||||
from django.utils.functional import cached_property
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
from django.views import View
|
||||
from django.views.generic import TemplateView
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ from django.shortcuts import redirect, render
|
||||
from django.urls import reverse
|
||||
from django.utils.functional import cached_property
|
||||
from django.utils.timezone import make_aware
|
||||
from django.utils.translation import pgettext_lazy, ugettext_lazy as _
|
||||
from django.utils.translation import gettext_lazy as _, pgettext_lazy
|
||||
from django.views import View
|
||||
from django.views.generic import CreateView, DeleteView, ListView, UpdateView
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ from django.shortcuts import get_object_or_404
|
||||
from django.urls import reverse
|
||||
from django.utils.formats import get_format
|
||||
from django.utils.timezone import make_aware
|
||||
from django.utils.translation import pgettext, ugettext as _
|
||||
from django.utils.translation import gettext as _, pgettext
|
||||
|
||||
from pretix.base.models import (
|
||||
EventMetaProperty, EventMetaValue, ItemMetaProperty, ItemMetaValue, Order,
|
||||
|
||||
@@ -15,9 +15,9 @@ from django.shortcuts import get_object_or_404, redirect
|
||||
from django.urls import reverse
|
||||
from django.utils.crypto import get_random_string
|
||||
from django.utils.functional import cached_property
|
||||
from django.utils.http import is_safe_url
|
||||
from django.utils.http import url_has_allowed_host_and_scheme
|
||||
from django.utils.timezone import now
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
from django.views import View
|
||||
from django.views.generic import FormView, ListView, TemplateView, UpdateView
|
||||
from django_otp.plugins.otp_static.models import StaticDevice
|
||||
@@ -102,7 +102,7 @@ class ReauthView(TemplateView):
|
||||
request.session['pretix_auth_login_time'] = t
|
||||
request.session['pretix_auth_last_used'] = t
|
||||
next_url = get_auth_backends()[request.user.auth_backend].get_next_url(request)
|
||||
if next_url and is_safe_url(next_url, allowed_hosts=None):
|
||||
if next_url and url_has_allowed_host_and_scheme(next_url, allowed_hosts=None):
|
||||
return redirect(next_url)
|
||||
return redirect(reverse('control:index'))
|
||||
else:
|
||||
@@ -114,7 +114,7 @@ class ReauthView(TemplateView):
|
||||
u = backend.request_authenticate(request)
|
||||
if u and u == request.user:
|
||||
next_url = backend.get_next_url(request)
|
||||
if next_url and is_safe_url(next_url, allowed_hosts=None):
|
||||
if next_url and url_has_allowed_host_and_scheme(next_url, allowed_hosts=None):
|
||||
return redirect(next_url)
|
||||
return redirect(reverse('control:index'))
|
||||
return super().get(request, *args, **kwargs)
|
||||
@@ -700,7 +700,7 @@ class StartStaffSession(StaffMemberRequiredMixin, RecentAuthenticationRequiredMi
|
||||
session_key=request.session.session_key
|
||||
)
|
||||
|
||||
if "next" in request.GET and is_safe_url(request.GET.get("next"), allowed_hosts=None):
|
||||
if "next" in request.GET and url_has_allowed_host_and_scheme(request.GET.get("next"), allowed_hosts=None):
|
||||
return redirect(request.GET.get("next"))
|
||||
else:
|
||||
return redirect(reverse("control:index"))
|
||||
|
||||
@@ -6,7 +6,7 @@ from django.contrib.auth.mixins import LoginRequiredMixin
|
||||
from django.shortcuts import get_object_or_404, redirect
|
||||
from django.urls import reverse
|
||||
from django.utils.functional import cached_property
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
from django.views import View
|
||||
from django.views.generic import ListView, TemplateView
|
||||
from hijack.helpers import login_user, release_hijack
|
||||
|
||||
@@ -14,7 +14,7 @@ from django.urls import resolve, reverse
|
||||
from django.utils.functional import cached_property
|
||||
from django.utils.html import format_html
|
||||
from django.utils.safestring import mark_safe
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
from django.views.generic import (
|
||||
CreateView, DeleteView, ListView, TemplateView, UpdateView, View,
|
||||
)
|
||||
|
||||
@@ -10,7 +10,7 @@ from django.shortcuts import redirect
|
||||
from django.urls import reverse
|
||||
from django.utils.http import is_safe_url
|
||||
from django.utils.timezone import now
|
||||
from django.utils.translation import pgettext, ugettext_lazy as _
|
||||
from django.utils.translation import gettext_lazy as _, pgettext
|
||||
from django.views import View
|
||||
from django.views.generic import ListView
|
||||
from django.views.generic.edit import DeleteView
|
||||
|
||||
Reference in New Issue
Block a user