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:
Raphael Michel
2018-08-06 12:48:46 +02:00
committed by GitHub
parent 0637490216
commit afd766999c
131 changed files with 491 additions and 263 deletions

View File

@@ -138,6 +138,7 @@ class AddOnsForm(forms.Form):
if override_price:
price = override_price
print(price, repr(price), type(price), repr(item.default_price))
if self.price_included:
price = TAXED_ZERO
else:

View File

@@ -1,4 +1,4 @@
from django.core.urlresolvers import resolve
from django.urls import resolve
from django.utils.deprecation import MiddlewareMixin
from pretix.presale.signals import process_response

View File

@@ -1,5 +1,5 @@
{% load compress %}
{% load staticfiles %}
{% load static %}
{% load i18n %}
{% load safelink %}
{% load statici18n %}

View File

@@ -1,6 +1,6 @@
{% extends "pretixpresale/base.html" %}
{% load i18n %}
{% load staticfiles %}
{% load static %}
{% load thumb %}
{% load eventurl %}
{% load safelink %}

View File

@@ -1,6 +1,6 @@
{% load i18n %}
{% load compress %}
{% load staticfiles %}
{% load static %}
<!DOCTYPE html>
<html>
<head>

View File

@@ -1,6 +1,6 @@
{% extends "pretixpresale/base.html" %}
{% load i18n %}
{% load staticfiles %}
{% load static %}
{% load thumb %}
{% load eventurl %}
{% block thetitle %}

View File

@@ -1,6 +1,6 @@
{% load compress %}
{% load i18n %}
{% load staticfiles %}
{% load static %}
<!DOCTYPE html>
<html>
<head>

View File

@@ -1,5 +1,5 @@
{% load compress %}
{% load staticfiles %}
{% load static %}
{% compress css %}
<link rel="stylesheet" type="text/x-scss" href="{% static "pretixpresale/scss/widget.scss" %}"/>
{% endcompress %}

View File

@@ -4,9 +4,9 @@ from urllib.parse import urljoin
from django.conf import settings
from django.core.exceptions import PermissionDenied
from django.core.urlresolvers import resolve
from django.http import Http404
from django.shortcuts import redirect
from django.urls import resolve
from django.utils.translation import ugettext_lazy as _
from pretix.base.middleware import LocaleMiddleware

View File

@@ -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 = {}

View File

@@ -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')

View File

@@ -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({