mirror of
https://github.com/pretix/pretix.git
synced 2026-05-10 16:04:02 +00:00
Upgrade to Django 2.1 (#710)
* Upgrade to Django 2.0 * more models * i18n foo * Update setup.py * Fix Sentry exception PRETIXEU-JC * Enforce slug uniqueness * Import sorting * Upgrade to Django 2.1 * Travis config * Try to fix PostgreSQL failure * Smaller test matrix * staticfiles→static * Include request in all authenticate() calls
This commit is contained in:
@@ -36,7 +36,7 @@ from pretix.presale.views.robots import NoSearchIndexViewMixin
|
||||
class CartActionMixin:
|
||||
|
||||
def get_next_url(self):
|
||||
if "next" in self.request.GET and is_safe_url(self.request.GET.get("next")):
|
||||
if "next" in self.request.GET and is_safe_url(self.request.GET.get("next"), allowed_hosts=None):
|
||||
u = self.request.GET.get('next')
|
||||
else:
|
||||
kwargs = {}
|
||||
|
||||
@@ -12,7 +12,7 @@ class LocaleSet(NoSearchIndexViewMixin, View):
|
||||
|
||||
def get(self, request, *args, **kwargs):
|
||||
url = request.GET.get('next', request.META.get('HTTP_REFERER', '/'))
|
||||
url = url if is_safe_url(url, host=request.get_host()) else '/'
|
||||
url = url if is_safe_url(url, allowed_hosts=[request.get_host()]) else '/'
|
||||
resp = HttpResponseRedirect(url)
|
||||
|
||||
locale = request.GET.get('locale')
|
||||
|
||||
@@ -14,11 +14,12 @@ from django.template.loader import get_template
|
||||
from django.utils.formats import date_format
|
||||
from django.utils.timezone import now
|
||||
from django.utils.translation import gettext
|
||||
from django.utils.translation.trans_real import DjangoTranslation
|
||||
from django.views import View
|
||||
from django.views.decorators.cache import cache_page
|
||||
from django.views.decorators.http import condition
|
||||
from django.views.i18n import (
|
||||
get_formats, get_javascript_catalog, js_catalog_template,
|
||||
JavaScriptCatalog, get_formats, js_catalog_template,
|
||||
)
|
||||
from lxml import etree
|
||||
|
||||
@@ -73,7 +74,10 @@ def generate_widget_js(lang):
|
||||
code.append('var module = {}, exports = {};\n')
|
||||
code.append('var lang = "%s";\n' % lang)
|
||||
|
||||
catalog, plural = get_javascript_catalog(lang, 'djangojs', ['pretix'])
|
||||
c = JavaScriptCatalog()
|
||||
c.translation = DjangoTranslation(lang, domain='djangojs')
|
||||
catalog, plural = c.get_catalog(), c.get_plural()
|
||||
|
||||
catalog = dict((k, v) for k, v in catalog.items() if k.startswith('widget\u0004'))
|
||||
template = Engine().from_string(js_catalog_template)
|
||||
context = Context({
|
||||
|
||||
Reference in New Issue
Block a user