mirror of
https://github.com/pretix/pretix.git
synced 2026-08-13 11:17:01 +00:00
Compare commits
52
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
916951aa68 | ||
|
|
3adb2eaacb | ||
|
|
436a8b0c24 | ||
|
|
deee2c9f66 | ||
|
|
cf87fa1039 | ||
|
|
7ed69a8ef7 | ||
|
|
ba37f2eb47 | ||
|
|
8ec81f80e8 | ||
|
|
257bb2e4b7 | ||
|
|
3953d57c2e | ||
|
|
2f1025c3a6 | ||
|
|
19f4dce267 | ||
|
|
e44f91530a | ||
|
|
d985fd61a1 | ||
|
|
803964da0e | ||
|
|
7e6df3d427 | ||
|
|
7b93cc57db | ||
|
|
21d62c5078 | ||
|
|
988dc112ac | ||
|
|
3843448812 | ||
|
|
49893ca9df | ||
|
|
4eade5070e | ||
|
|
32b1997208 | ||
|
|
eaf4a310f6 | ||
|
|
8dc0f7c1b2 | ||
|
|
dd3e6c4692 | ||
|
|
c7437336b4 | ||
|
|
4c0c775baa | ||
|
|
394652a5ff | ||
|
|
3f50d065ec | ||
|
|
4121061267 | ||
|
|
aed2220139 | ||
|
|
4b2c54d38e | ||
|
|
0113a3dc1f | ||
|
|
c12a8935f1 | ||
|
|
a86a6cc2c7 | ||
|
|
fec2b9a2fc | ||
|
|
d847a7e8f8 | ||
|
|
c58a968196 | ||
|
|
81cbaca162 | ||
|
|
218df7a49f | ||
|
|
f64343d977 | ||
|
|
b36c7cbef3 | ||
|
|
18b39ba7cd | ||
|
|
1383e967df | ||
|
|
c743e9fd3f | ||
|
|
a71efa6747 | ||
|
|
4fed47fb9b | ||
|
|
c143d50290 | ||
|
|
88cd715ece | ||
|
|
3513de6a45 | ||
|
|
fd6d3934c0 |
@@ -24,7 +24,7 @@ jobs:
|
|||||||
name: Packaging
|
name: Packaging
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
python-version: ["3.11"]
|
python-version: ["3.13"]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Set up Python ${{ matrix.python-version }}
|
- name: Set up Python ${{ matrix.python-version }}
|
||||||
|
|||||||
@@ -24,10 +24,10 @@ jobs:
|
|||||||
name: Check gettext syntax
|
name: Check gettext syntax
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Set up Python 3.11
|
- name: Set up Python 3.13
|
||||||
uses: actions/setup-python@v5
|
uses: actions/setup-python@v5
|
||||||
with:
|
with:
|
||||||
python-version: 3.11
|
python-version: 3.13
|
||||||
- uses: actions/cache@v4
|
- uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
path: ~/.cache/pip
|
path: ~/.cache/pip
|
||||||
@@ -49,10 +49,10 @@ jobs:
|
|||||||
name: Spellcheck
|
name: Spellcheck
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Set up Python 3.11
|
- name: Set up Python 3.13
|
||||||
uses: actions/setup-python@v5
|
uses: actions/setup-python@v5
|
||||||
with:
|
with:
|
||||||
python-version: 3.11
|
python-version: 3.13
|
||||||
- uses: actions/cache@v4
|
- uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
path: ~/.cache/pip
|
path: ~/.cache/pip
|
||||||
|
|||||||
@@ -24,10 +24,10 @@ jobs:
|
|||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Set up Python 3.11
|
- name: Set up Python 3.13
|
||||||
uses: actions/setup-python@v5
|
uses: actions/setup-python@v5
|
||||||
with:
|
with:
|
||||||
python-version: 3.11
|
python-version: 3.13
|
||||||
- uses: actions/cache@v4
|
- uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
path: ~/.cache/pip
|
path: ~/.cache/pip
|
||||||
@@ -44,10 +44,10 @@ jobs:
|
|||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Set up Python 3.11
|
- name: Set up Python 3.13
|
||||||
uses: actions/setup-python@v5
|
uses: actions/setup-python@v5
|
||||||
with:
|
with:
|
||||||
python-version: 3.11
|
python-version: 3.13
|
||||||
- uses: actions/cache@v4
|
- uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
path: ~/.cache/pip
|
path: ~/.cache/pip
|
||||||
@@ -64,10 +64,10 @@ jobs:
|
|||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Set up Python 3.11
|
- name: Set up Python 3.13
|
||||||
uses: actions/setup-python@v5
|
uses: actions/setup-python@v5
|
||||||
with:
|
with:
|
||||||
python-version: 3.11
|
python-version: 3.13
|
||||||
- name: Install Dependencies
|
- name: Install Dependencies
|
||||||
run: pip3 install licenseheaders
|
run: pip3 install licenseheaders
|
||||||
- name: Run licenseheaders
|
- name: Run licenseheaders
|
||||||
|
|||||||
@@ -23,13 +23,15 @@ jobs:
|
|||||||
name: Tests
|
name: Tests
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
python-version: ["3.10", "3.11", "3.13"]
|
python-version: ["3.11", "3.13", "3.14"]
|
||||||
database: [sqlite, postgres]
|
database: [sqlite, postgres]
|
||||||
exclude:
|
exclude:
|
||||||
- database: sqlite
|
- database: sqlite
|
||||||
python-version: "3.10"
|
python-version: "3.10"
|
||||||
- database: sqlite
|
- database: sqlite
|
||||||
python-version: "3.11"
|
python-version: "3.11"
|
||||||
|
- database: sqlite
|
||||||
|
python-version: "3.12"
|
||||||
services:
|
services:
|
||||||
postgres:
|
postgres:
|
||||||
image: postgres:15
|
image: postgres:15
|
||||||
@@ -81,4 +83,4 @@ jobs:
|
|||||||
file: src/coverage.xml
|
file: src/coverage.xml
|
||||||
token: ${{ secrets.CODECOV_TOKEN }}
|
token: ${{ secrets.CODECOV_TOKEN }}
|
||||||
fail_ci_if_error: false
|
fail_ci_if_error: false
|
||||||
if: matrix.database == 'postgres' && matrix.python-version == '3.11'
|
if: matrix.database == 'postgres' && matrix.python-version == '3.13'
|
||||||
|
|||||||
+3
-2
@@ -10,9 +10,10 @@ tests:
|
|||||||
- cd src
|
- cd src
|
||||||
- python manage.py check
|
- python manage.py check
|
||||||
- make all compress
|
- make all compress
|
||||||
|
- playwright install
|
||||||
- PRETIX_CONFIG_FILE=tests/ci_sqlite.cfg py.test -n 3 tests --maxfail=100
|
- PRETIX_CONFIG_FILE=tests/ci_sqlite.cfg py.test -n 3 tests --maxfail=100
|
||||||
except:
|
except:
|
||||||
- pypi
|
- '/^v.*$/'
|
||||||
pypi:
|
pypi:
|
||||||
stage: release
|
stage: release
|
||||||
image:
|
image:
|
||||||
@@ -35,7 +36,7 @@ pypi:
|
|||||||
- twine check dist/*
|
- twine check dist/*
|
||||||
- twine upload dist/*
|
- twine upload dist/*
|
||||||
only:
|
only:
|
||||||
- pypi
|
- '/^v.*$/'
|
||||||
artifacts:
|
artifacts:
|
||||||
paths:
|
paths:
|
||||||
- src/dist/
|
- src/dist/
|
||||||
|
|||||||
+8
-7
@@ -3,7 +3,7 @@ name = "pretix"
|
|||||||
dynamic = ["version"]
|
dynamic = ["version"]
|
||||||
description = "Reinventing presales, one ticket at a time"
|
description = "Reinventing presales, one ticket at a time"
|
||||||
readme = "README.rst"
|
readme = "README.rst"
|
||||||
requires-python = ">=3.10"
|
requires-python = ">=3.11"
|
||||||
license = {file = "LICENSE"}
|
license = {file = "LICENSE"}
|
||||||
keywords = ["tickets", "web", "shop", "ecommerce"]
|
keywords = ["tickets", "web", "shop", "ecommerce"]
|
||||||
authors = [
|
authors = [
|
||||||
@@ -19,10 +19,11 @@ classifiers = [
|
|||||||
"Topic :: Internet :: WWW/HTTP :: Dynamic Content",
|
"Topic :: Internet :: WWW/HTTP :: Dynamic Content",
|
||||||
"Environment :: Web Environment",
|
"Environment :: Web Environment",
|
||||||
"License :: OSI Approved :: GNU Affero General Public License v3",
|
"License :: OSI Approved :: GNU Affero General Public License v3",
|
||||||
"Programming Language :: Python :: 3.9",
|
|
||||||
"Programming Language :: Python :: 3.10",
|
|
||||||
"Programming Language :: Python :: 3.11",
|
"Programming Language :: Python :: 3.11",
|
||||||
"Framework :: Django :: 4.2",
|
"Programming Language :: Python :: 3.12",
|
||||||
|
"Programming Language :: Python :: 3.13",
|
||||||
|
"Programming Language :: Python :: 3.14",
|
||||||
|
"Framework :: Django :: 5.2",
|
||||||
]
|
]
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
@@ -36,7 +37,7 @@ dependencies = [
|
|||||||
"css-inline==0.20.*",
|
"css-inline==0.20.*",
|
||||||
"defusedcsv>=1.1.0",
|
"defusedcsv>=1.1.0",
|
||||||
"dnspython==2.*",
|
"dnspython==2.*",
|
||||||
"Django[argon2]==4.2.*,>=4.2.26",
|
"Django[argon2]==5.2.*",
|
||||||
"django-bootstrap3==26.1",
|
"django-bootstrap3==26.1",
|
||||||
"django-compressor==4.6.0",
|
"django-compressor==4.6.0",
|
||||||
"django-countries==8.2.*",
|
"django-countries==8.2.*",
|
||||||
@@ -59,7 +60,7 @@ dependencies = [
|
|||||||
"dnspython==2.8.*",
|
"dnspython==2.8.*",
|
||||||
"drf_ujson2==1.7.*",
|
"drf_ujson2==1.7.*",
|
||||||
"geoip2==5.*",
|
"geoip2==5.*",
|
||||||
"importlib_metadata==8.*", # Polyfill, we can probably drop this once we require Python 3.10+
|
"importlib_metadata==9.*", # Polyfill, we can probably drop this once we require Python 3.10+
|
||||||
"isoweek",
|
"isoweek",
|
||||||
"jsonschema",
|
"jsonschema",
|
||||||
"kombu==5.6.*",
|
"kombu==5.6.*",
|
||||||
@@ -92,7 +93,7 @@ dependencies = [
|
|||||||
"redis==7.1.*",
|
"redis==7.1.*",
|
||||||
"reportlab==4.4.*",
|
"reportlab==4.4.*",
|
||||||
"requests==2.32.*",
|
"requests==2.32.*",
|
||||||
"sentry-sdk==2.54.*",
|
"sentry-sdk==2.56.*",
|
||||||
"sepaxml==2.7.*",
|
"sepaxml==2.7.*",
|
||||||
"stripe==7.9.*",
|
"stripe==7.9.*",
|
||||||
"text-unidecode==1.*",
|
"text-unidecode==1.*",
|
||||||
|
|||||||
@@ -19,4 +19,4 @@
|
|||||||
# You should have received a copy of the GNU Affero General Public License along with this program. If not, see
|
# You should have received a copy of the GNU Affero General Public License along with this program. If not, see
|
||||||
# <https://www.gnu.org/licenses/>.
|
# <https://www.gnu.org/licenses/>.
|
||||||
#
|
#
|
||||||
__version__ = "2026.3.0.dev0"
|
__version__ = "2026.3.5"
|
||||||
|
|||||||
@@ -1122,7 +1122,7 @@ class CheckinViewSet(viewsets.ReadOnlyModelViewSet):
|
|||||||
permission = 'event.orders:read'
|
permission = 'event.orders:read'
|
||||||
|
|
||||||
def get_queryset(self):
|
def get_queryset(self):
|
||||||
qs = Checkin.all.filter().select_related(
|
qs = Checkin.all.filter(list__event=self.request.event).select_related(
|
||||||
"position",
|
"position",
|
||||||
"device",
|
"device",
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -69,7 +69,9 @@ class ReusableMediaExporter(OrganizerLevelExportMixin, ListExporter):
|
|||||||
date_format(medium.expires, 'SHORT_DATETIME_FORMAT') if medium.expires else '',
|
date_format(medium.expires, 'SHORT_DATETIME_FORMAT') if medium.expires else '',
|
||||||
medium.customer.identifier if medium.customer_id else '',
|
medium.customer.identifier if medium.customer_id else '',
|
||||||
f"{medium.linked_orderposition.order.code}-{medium.linked_orderposition.positionid}" if medium.linked_orderposition_id else '',
|
f"{medium.linked_orderposition.order.code}-{medium.linked_orderposition.positionid}" if medium.linked_orderposition_id else '',
|
||||||
medium.linked_giftcard.secret if medium.linked_giftcard_id else '',
|
# we cannot determine here whether user has permission organizer.giftcards:read
|
||||||
|
# so default to not showing giftcard secret
|
||||||
|
medium.linked_giftcard.secret[:3] + "…" if medium.linked_giftcard_id else '',
|
||||||
medium.notes,
|
medium.notes,
|
||||||
]
|
]
|
||||||
yield row
|
yield row
|
||||||
|
|||||||
@@ -196,8 +196,7 @@ class RegistrationForm(forms.Form):
|
|||||||
def clean_password(self):
|
def clean_password(self):
|
||||||
password1 = self.cleaned_data.get('password', '')
|
password1 = self.cleaned_data.get('password', '')
|
||||||
user = User(email=self.cleaned_data.get('email'))
|
user = User(email=self.cleaned_data.get('email'))
|
||||||
if validate_password(password1, user=user) is not None:
|
validate_password(password1, user=user)
|
||||||
raise forms.ValidationError(_(password_validators_help_texts()), code='pw_invalid')
|
|
||||||
return password1
|
return password1
|
||||||
|
|
||||||
def clean_email(self):
|
def clean_email(self):
|
||||||
|
|||||||
@@ -45,7 +45,6 @@ import pycountry
|
|||||||
from django import forms
|
from django import forms
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.contrib import messages
|
from django.contrib import messages
|
||||||
from django.contrib.gis.geoip2 import GeoIP2
|
|
||||||
from django.core.exceptions import ValidationError
|
from django.core.exceptions import ValidationError
|
||||||
from django.core.files.uploadedfile import SimpleUploadedFile
|
from django.core.files.uploadedfile import SimpleUploadedFile
|
||||||
from django.core.validators import (
|
from django.core.validators import (
|
||||||
@@ -102,6 +101,7 @@ from pretix.helpers.countries import (
|
|||||||
from pretix.helpers.escapejson import escapejson_attr
|
from pretix.helpers.escapejson import escapejson_attr
|
||||||
from pretix.helpers.http import get_client_ip
|
from pretix.helpers.http import get_client_ip
|
||||||
from pretix.helpers.i18n import get_format_without_seconds
|
from pretix.helpers.i18n import get_format_without_seconds
|
||||||
|
from pretix.helpers.security import get_geoip
|
||||||
from pretix.presale.signals import question_form_fields
|
from pretix.presale.signals import question_form_fields
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
@@ -393,7 +393,7 @@ class WrappedPhoneNumberPrefixWidget(PhoneNumberPrefixWidget):
|
|||||||
|
|
||||||
def guess_country_from_request(request, event):
|
def guess_country_from_request(request, event):
|
||||||
if settings.HAS_GEOIP:
|
if settings.HAS_GEOIP:
|
||||||
g = GeoIP2()
|
g = get_geoip()
|
||||||
try:
|
try:
|
||||||
res = g.country(get_client_ip(request))
|
res = g.country(get_client_ip(request))
|
||||||
if res['country_code'] and len(res['country_code']) == 2:
|
if res['country_code'] and len(res['country_code']) == 2:
|
||||||
|
|||||||
@@ -22,9 +22,7 @@
|
|||||||
import datetime
|
import datetime
|
||||||
import logging
|
import logging
|
||||||
import math
|
import math
|
||||||
import re
|
|
||||||
import textwrap
|
import textwrap
|
||||||
import unicodedata
|
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
@@ -58,8 +56,8 @@ from pretix.base.services.currencies import SOURCE_NAMES
|
|||||||
from pretix.base.signals import register_invoice_renderers
|
from pretix.base.signals import register_invoice_renderers
|
||||||
from pretix.base.templatetags.money import money_filter
|
from pretix.base.templatetags.money import money_filter
|
||||||
from pretix.helpers.reportlab import (
|
from pretix.helpers.reportlab import (
|
||||||
FontFallbackParagraph, ThumbnailingImageReader, register_ttf_font_if_new,
|
FontFallbackParagraph, PlainTextParagraph, ThumbnailingImageReader,
|
||||||
reshaper,
|
normalize_text, register_ttf_font_if_new, reshaper,
|
||||||
)
|
)
|
||||||
from pretix.presale.style import get_fonts
|
from pretix.presale.style import get_fonts
|
||||||
|
|
||||||
@@ -259,18 +257,8 @@ class BaseReportlabInvoiceRenderer(BaseInvoiceRenderer):
|
|||||||
register_ttf_font_if_new(family + ' B I', finders.find(styles['bolditalic']['truetype']))
|
register_ttf_font_if_new(family + ' B I', finders.find(styles['bolditalic']['truetype']))
|
||||||
|
|
||||||
def _normalize(self, text):
|
def _normalize(self, text):
|
||||||
# reportlab does not support unicode combination characters
|
# alias kept for plugin compatibility
|
||||||
# It's important we do this before we use ArabicReshaper
|
return normalize_text(text)
|
||||||
text = unicodedata.normalize("NFKC", text)
|
|
||||||
|
|
||||||
# reportlab does not support RTL, ligature-heavy scripts like Arabic. Therefore, we use ArabicReshaper
|
|
||||||
# to resolve all ligatures and python-bidi to switch RTL texts.
|
|
||||||
try:
|
|
||||||
text = "<br />".join(get_display(reshaper.reshape(l)) for l in re.split("<br ?/>", text))
|
|
||||||
except:
|
|
||||||
logger.exception('Reshaping/Bidi fixes failed on string {}'.format(repr(text)))
|
|
||||||
|
|
||||||
return text
|
|
||||||
|
|
||||||
def _upper(self, val):
|
def _upper(self, val):
|
||||||
# We uppercase labels, but not in every language
|
# We uppercase labels, but not in every language
|
||||||
@@ -351,10 +339,15 @@ class BaseReportlabInvoiceRenderer(BaseInvoiceRenderer):
|
|||||||
return 'invoice.pdf', 'application/pdf', buffer.read()
|
return 'invoice.pdf', 'application/pdf', buffer.read()
|
||||||
|
|
||||||
def _clean_text(self, text, tags=None):
|
def _clean_text(self, text, tags=None):
|
||||||
return self._normalize(bleach.clean(
|
# For backwards compatibility with customer content, we need to support tags like <br> and <b> in a few text
|
||||||
text,
|
# fields. Therefore, we can't use PlainTextParagraph for these, but run bleach instead to limit the allowed
|
||||||
tags=set(tags) if tags else set()
|
# tags.
|
||||||
).strip().replace('<br>', '<br />').replace('\n', '<br />\n'))
|
return self._normalize(
|
||||||
|
bleach.clean(
|
||||||
|
text,
|
||||||
|
tags=set(tags) if tags else set()
|
||||||
|
).strip().replace('<br>', '<br />').replace('\n', '<br />\n')
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class PaidMarker(Flowable):
|
class PaidMarker(Flowable):
|
||||||
@@ -405,8 +398,7 @@ class ClassicInvoiceRenderer(BaseReportlabInvoiceRenderer):
|
|||||||
invoice_to_top = 52 * mm
|
invoice_to_top = 52 * mm
|
||||||
|
|
||||||
def _draw_invoice_to(self, canvas):
|
def _draw_invoice_to(self, canvas):
|
||||||
p = FontFallbackParagraph(self._clean_text(self.invoice.address_invoice_to),
|
p = PlainTextParagraph(self.invoice.address_invoice_to, style=self.stylesheet['Normal'])
|
||||||
style=self.stylesheet['Normal'])
|
|
||||||
p.wrapOn(canvas, self.invoice_to_width, self.invoice_to_height)
|
p.wrapOn(canvas, self.invoice_to_width, self.invoice_to_height)
|
||||||
p_size = p.wrap(self.invoice_to_width, self.invoice_to_height)
|
p_size = p.wrap(self.invoice_to_width, self.invoice_to_height)
|
||||||
p.drawOn(canvas, self.invoice_to_left, self.pagesize[1] - p_size[1] - self.invoice_to_top)
|
p.drawOn(canvas, self.invoice_to_left, self.pagesize[1] - p_size[1] - self.invoice_to_top)
|
||||||
@@ -417,8 +409,8 @@ class ClassicInvoiceRenderer(BaseReportlabInvoiceRenderer):
|
|||||||
invoice_from_top = 17 * mm
|
invoice_from_top = 17 * mm
|
||||||
|
|
||||||
def _draw_invoice_from(self, canvas):
|
def _draw_invoice_from(self, canvas):
|
||||||
p = FontFallbackParagraph(
|
p = PlainTextParagraph(
|
||||||
self._clean_text(self.invoice.full_invoice_from),
|
self.invoice.full_invoice_from,
|
||||||
style=self.stylesheet['InvoiceFrom']
|
style=self.stylesheet['InvoiceFrom']
|
||||||
)
|
)
|
||||||
p.wrapOn(canvas, self.invoice_from_width, self.invoice_from_height)
|
p.wrapOn(canvas, self.invoice_from_width, self.invoice_from_height)
|
||||||
@@ -548,13 +540,12 @@ class ClassicInvoiceRenderer(BaseReportlabInvoiceRenderer):
|
|||||||
def _draw_event(self, canvas):
|
def _draw_event(self, canvas):
|
||||||
def shorten(txt):
|
def shorten(txt):
|
||||||
txt = str(txt)
|
txt = str(txt)
|
||||||
txt = bleach.clean(txt, tags=set()).strip()
|
p = PlainTextParagraph(txt, style=self.stylesheet['Normal'])
|
||||||
p = FontFallbackParagraph(self._normalize(txt.strip().replace('\n', '<br />\n')), style=self.stylesheet['Normal'])
|
|
||||||
p_size = p.wrap(self.event_width, self.event_height)
|
p_size = p.wrap(self.event_width, self.event_height)
|
||||||
|
|
||||||
while p_size[1] > 2 * self.stylesheet['Normal'].leading:
|
while p_size[1] > 2 * self.stylesheet['Normal'].leading:
|
||||||
txt = ' '.join(txt.replace('…', '').split()[:-1]) + '…'
|
txt = ' '.join(txt.replace('…', '').split()[:-1]) + '…'
|
||||||
p = FontFallbackParagraph(self._normalize(txt.strip().replace('\n', '<br />\n')), style=self.stylesheet['Normal'])
|
p = PlainTextParagraph(txt, style=self.stylesheet['Normal'])
|
||||||
p_size = p.wrap(self.event_width, self.event_height)
|
p_size = p.wrap(self.event_width, self.event_height)
|
||||||
return txt
|
return txt
|
||||||
|
|
||||||
@@ -572,7 +563,7 @@ class ClassicInvoiceRenderer(BaseReportlabInvoiceRenderer):
|
|||||||
else:
|
else:
|
||||||
p_str = shorten(self.invoice.event.name)
|
p_str = shorten(self.invoice.event.name)
|
||||||
|
|
||||||
p = FontFallbackParagraph(self._normalize(p_str.strip().replace('\n', '<br />\n')), style=self.stylesheet['Normal'])
|
p = PlainTextParagraph(p_str, style=self.stylesheet['Normal'])
|
||||||
p.wrapOn(canvas, self.event_width, self.event_height)
|
p.wrapOn(canvas, self.event_width, self.event_height)
|
||||||
p_size = p.wrap(self.event_width, self.event_height)
|
p_size = p.wrap(self.event_width, self.event_height)
|
||||||
p.drawOn(canvas, self.event_left, self.pagesize[1] - self.event_top - p_size[1])
|
p.drawOn(canvas, self.event_left, self.pagesize[1] - self.event_top - p_size[1])
|
||||||
@@ -645,39 +636,37 @@ class ClassicInvoiceRenderer(BaseReportlabInvoiceRenderer):
|
|||||||
|
|
||||||
type_info_text = self.invoice.transmission_type_instance.pdf_info_text()
|
type_info_text = self.invoice.transmission_type_instance.pdf_info_text()
|
||||||
if type_info_text:
|
if type_info_text:
|
||||||
story.append(FontFallbackParagraph(
|
story.append(PlainTextParagraph(
|
||||||
type_info_text,
|
type_info_text,
|
||||||
self.stylesheet['WarningBlock']
|
self.stylesheet['WarningBlock']
|
||||||
))
|
))
|
||||||
|
|
||||||
if self.invoice.custom_field:
|
if self.invoice.custom_field:
|
||||||
story.append(FontFallbackParagraph(
|
story.append(PlainTextParagraph(
|
||||||
'{}: {}'.format(
|
'{}: {}'.format(
|
||||||
self._clean_text(str(self.invoice.event.settings.invoice_address_custom_field)),
|
str(self.invoice.event.settings.invoice_address_custom_field),
|
||||||
self._clean_text(self.invoice.custom_field),
|
self.invoice.custom_field,
|
||||||
),
|
),
|
||||||
self.stylesheet['Normal']
|
self.stylesheet['Normal']
|
||||||
))
|
))
|
||||||
|
|
||||||
if self.invoice.internal_reference:
|
if self.invoice.internal_reference:
|
||||||
story.append(FontFallbackParagraph(
|
story.append(PlainTextParagraph(
|
||||||
self._normalize(pgettext('invoice', 'Customer reference: {reference}').format(
|
pgettext('invoice', 'Customer reference: {reference}').format(
|
||||||
reference=self._clean_text(self.invoice.internal_reference),
|
reference=self.invoice.internal_reference,
|
||||||
)),
|
),
|
||||||
self.stylesheet['Normal']
|
self.stylesheet['Normal']
|
||||||
))
|
))
|
||||||
|
|
||||||
if self.invoice.invoice_to_vat_id:
|
if self.invoice.invoice_to_vat_id:
|
||||||
story.append(FontFallbackParagraph(
|
story.append(PlainTextParagraph(
|
||||||
self._normalize(pgettext('invoice', 'Customer VAT ID')) + ': ' +
|
pgettext('invoice', 'Customer VAT ID') + ': ' + self.invoice.invoice_to_vat_id,
|
||||||
self._clean_text(self.invoice.invoice_to_vat_id),
|
|
||||||
self.stylesheet['Normal']
|
self.stylesheet['Normal']
|
||||||
))
|
))
|
||||||
|
|
||||||
if self.invoice.invoice_to_beneficiary:
|
if self.invoice.invoice_to_beneficiary:
|
||||||
story.append(FontFallbackParagraph(
|
story.append(PlainTextParagraph(
|
||||||
self._normalize(pgettext('invoice', 'Beneficiary')) + ':<br />' +
|
pgettext('invoice', 'Beneficiary') + ':\n' + self.invoice.invoice_to_beneficiary,
|
||||||
self._clean_text(self.invoice.invoice_to_beneficiary),
|
|
||||||
self.stylesheet['Normal']
|
self.stylesheet['Normal']
|
||||||
))
|
))
|
||||||
|
|
||||||
@@ -707,11 +696,11 @@ class ClassicInvoiceRenderer(BaseReportlabInvoiceRenderer):
|
|||||||
|
|
||||||
story = [
|
story = [
|
||||||
NextPageTemplate('FirstPage'),
|
NextPageTemplate('FirstPage'),
|
||||||
FontFallbackParagraph(
|
PlainTextParagraph(
|
||||||
self._normalize(
|
(
|
||||||
pgettext('invoice', 'Tax Invoice') if str(self.invoice.invoice_from_country) == 'AU'
|
pgettext('invoice', 'Tax Invoice') if str(self.invoice.invoice_from_country) == 'AU'
|
||||||
else pgettext('invoice', 'Invoice')
|
else pgettext('invoice', 'Invoice')
|
||||||
) if not self.invoice.is_cancellation else self._normalize(pgettext('invoice', 'Cancellation')),
|
) if not self.invoice.is_cancellation else pgettext('invoice', 'Cancellation'),
|
||||||
self.stylesheet['Heading1']
|
self.stylesheet['Heading1']
|
||||||
),
|
),
|
||||||
Spacer(1, 5 * mm),
|
Spacer(1, 5 * mm),
|
||||||
@@ -733,17 +722,17 @@ class ClassicInvoiceRenderer(BaseReportlabInvoiceRenderer):
|
|||||||
]
|
]
|
||||||
if has_taxes:
|
if has_taxes:
|
||||||
tdata = [(
|
tdata = [(
|
||||||
FontFallbackParagraph(self._normalize(pgettext('invoice', 'Description')), self.stylesheet['Bold']),
|
PlainTextParagraph(pgettext('invoice', 'Description'), self.stylesheet['Bold']),
|
||||||
FontFallbackParagraph(self._normalize(pgettext('invoice', 'Qty')), self.stylesheet['BoldRightNoSplit']),
|
PlainTextParagraph(pgettext('invoice', 'Qty'), self.stylesheet['BoldRightNoSplit']),
|
||||||
FontFallbackParagraph(self._normalize(pgettext('invoice', 'Tax rate')), self.stylesheet['BoldRightNoSplit']),
|
PlainTextParagraph(pgettext('invoice', 'Tax rate'), self.stylesheet['BoldRightNoSplit']),
|
||||||
FontFallbackParagraph(self._normalize(pgettext('invoice', 'Net')), self.stylesheet['BoldRightNoSplit']),
|
PlainTextParagraph(pgettext('invoice', 'Net'), self.stylesheet['BoldRightNoSplit']),
|
||||||
FontFallbackParagraph(self._normalize(pgettext('invoice', 'Gross')), self.stylesheet['BoldRightNoSplit']),
|
PlainTextParagraph(pgettext('invoice', 'Gross'), self.stylesheet['BoldRightNoSplit']),
|
||||||
)]
|
)]
|
||||||
else:
|
else:
|
||||||
tdata = [(
|
tdata = [(
|
||||||
FontFallbackParagraph(self._normalize(pgettext('invoice', 'Description')), self.stylesheet['Bold']),
|
PlainTextParagraph(pgettext('invoice', 'Description'), self.stylesheet['Bold']),
|
||||||
FontFallbackParagraph(self._normalize(pgettext('invoice', 'Qty')), self.stylesheet['BoldRightNoSplit']),
|
PlainTextParagraph(pgettext('invoice', 'Qty'), self.stylesheet['BoldRightNoSplit']),
|
||||||
FontFallbackParagraph(self._normalize(pgettext('invoice', 'Amount')), self.stylesheet['BoldRightNoSplit']),
|
PlainTextParagraph(pgettext('invoice', 'Amount'), self.stylesheet['BoldRightNoSplit']),
|
||||||
)]
|
)]
|
||||||
|
|
||||||
def _group_key(line):
|
def _group_key(line):
|
||||||
@@ -780,8 +769,8 @@ class ClassicInvoiceRenderer(BaseReportlabInvoiceRenderer):
|
|||||||
max_height = self.stylesheet['Normal'].leading * 5
|
max_height = self.stylesheet['Normal'].leading * 5
|
||||||
p_style = self.stylesheet['Normal']
|
p_style = self.stylesheet['Normal']
|
||||||
for __ in range(1000):
|
for __ in range(1000):
|
||||||
p = FontFallbackParagraph(
|
p = PlainTextParagraph(
|
||||||
self._clean_text(curr_description, tags=['br']),
|
curr_description,
|
||||||
p_style
|
p_style
|
||||||
)
|
)
|
||||||
h = p.wrap(max_width, doc.height)[1]
|
h = p.wrap(max_width, doc.height)[1]
|
||||||
@@ -862,7 +851,7 @@ class ClassicInvoiceRenderer(BaseReportlabInvoiceRenderer):
|
|||||||
# Group together at the end of the invoice
|
# Group together at the end of the invoice
|
||||||
request_show_service_date = period_line
|
request_show_service_date = period_line
|
||||||
elif period_line:
|
elif period_line:
|
||||||
description_p_list.append(FontFallbackParagraph(
|
description_p_list.append(PlainTextParagraph(
|
||||||
period_line,
|
period_line,
|
||||||
self.stylesheet['Fineprint']
|
self.stylesheet['Fineprint']
|
||||||
))
|
))
|
||||||
@@ -874,7 +863,7 @@ class ClassicInvoiceRenderer(BaseReportlabInvoiceRenderer):
|
|||||||
net_price=money_filter(net_value, self.invoice.event.currency),
|
net_price=money_filter(net_value, self.invoice.event.currency),
|
||||||
gross_price=money_filter(gross_value, self.invoice.event.currency),
|
gross_price=money_filter(gross_value, self.invoice.event.currency),
|
||||||
)
|
)
|
||||||
description_p_list.append(FontFallbackParagraph(
|
description_p_list.append(PlainTextParagraph(
|
||||||
single_price_line,
|
single_price_line,
|
||||||
self.stylesheet['Fineprint']
|
self.stylesheet['Fineprint']
|
||||||
))
|
))
|
||||||
@@ -883,11 +872,11 @@ class ClassicInvoiceRenderer(BaseReportlabInvoiceRenderer):
|
|||||||
description_p_list.pop(0),
|
description_p_list.pop(0),
|
||||||
str(len(lines)),
|
str(len(lines)),
|
||||||
localize(tax_rate) + " %",
|
localize(tax_rate) + " %",
|
||||||
FontFallbackParagraph(
|
PlainTextParagraph(
|
||||||
money_filter(net_value * len(lines), self.invoice.event.currency).replace('\xa0', ' '),
|
money_filter(net_value * len(lines), self.invoice.event.currency).replace('\xa0', ' '),
|
||||||
self.stylesheet['NormalRight']
|
self.stylesheet['NormalRight']
|
||||||
),
|
),
|
||||||
FontFallbackParagraph(
|
PlainTextParagraph(
|
||||||
money_filter(gross_value * len(lines), self.invoice.event.currency).replace('\xa0', ' '),
|
money_filter(gross_value * len(lines), self.invoice.event.currency).replace('\xa0', ' '),
|
||||||
self.stylesheet['NormalRight']
|
self.stylesheet['NormalRight']
|
||||||
),
|
),
|
||||||
@@ -904,14 +893,14 @@ class ClassicInvoiceRenderer(BaseReportlabInvoiceRenderer):
|
|||||||
single_price_line = pgettext('invoice', 'Single price: {price}').format(
|
single_price_line = pgettext('invoice', 'Single price: {price}').format(
|
||||||
price=money_filter(gross_value, self.invoice.event.currency),
|
price=money_filter(gross_value, self.invoice.event.currency),
|
||||||
)
|
)
|
||||||
description_p_list.append(FontFallbackParagraph(
|
description_p_list.append(PlainTextParagraph(
|
||||||
single_price_line,
|
single_price_line,
|
||||||
self.stylesheet['Fineprint']
|
self.stylesheet['Fineprint']
|
||||||
))
|
))
|
||||||
tdata.append((
|
tdata.append((
|
||||||
description_p_list.pop(0),
|
description_p_list.pop(0),
|
||||||
str(len(lines)),
|
str(len(lines)),
|
||||||
FontFallbackParagraph(
|
PlainTextParagraph(
|
||||||
money_filter(gross_value * len(lines), self.invoice.event.currency).replace('\xa0', ' '),
|
money_filter(gross_value * len(lines), self.invoice.event.currency).replace('\xa0', ' '),
|
||||||
self.stylesheet['NormalRight']
|
self.stylesheet['NormalRight']
|
||||||
),
|
),
|
||||||
@@ -944,12 +933,12 @@ class ClassicInvoiceRenderer(BaseReportlabInvoiceRenderer):
|
|||||||
|
|
||||||
if has_taxes:
|
if has_taxes:
|
||||||
tdata.append([
|
tdata.append([
|
||||||
FontFallbackParagraph(self._normalize(pgettext('invoice', 'Invoice total')), self.stylesheet['Bold']), '', '', '',
|
PlainTextParagraph(pgettext('invoice', 'Invoice total'), self.stylesheet['Bold']), '', '', '',
|
||||||
money_filter(total, self.invoice.event.currency)
|
money_filter(total, self.invoice.event.currency)
|
||||||
])
|
])
|
||||||
else:
|
else:
|
||||||
tdata.append([
|
tdata.append([
|
||||||
FontFallbackParagraph(self._normalize(pgettext('invoice', 'Invoice total')), self.stylesheet['Bold']), '',
|
PlainTextParagraph(pgettext('invoice', 'Invoice total'), self.stylesheet['Bold']), '',
|
||||||
money_filter(total, self.invoice.event.currency)
|
money_filter(total, self.invoice.event.currency)
|
||||||
])
|
])
|
||||||
|
|
||||||
@@ -958,12 +947,12 @@ class ClassicInvoiceRenderer(BaseReportlabInvoiceRenderer):
|
|||||||
pending_sum = self.invoice.order.pending_sum
|
pending_sum = self.invoice.order.pending_sum
|
||||||
if pending_sum != total:
|
if pending_sum != total:
|
||||||
tdata.append(
|
tdata.append(
|
||||||
[FontFallbackParagraph(self._normalize(pgettext('invoice', 'Received payments')), self.stylesheet['Normal'])] +
|
[PlainTextParagraph(pgettext('invoice', 'Received payments'), self.stylesheet['Normal'])] +
|
||||||
(['', '', ''] if has_taxes else ['']) +
|
(['', '', ''] if has_taxes else ['']) +
|
||||||
[money_filter(pending_sum - total, self.invoice.event.currency)]
|
[money_filter(pending_sum - total, self.invoice.event.currency)]
|
||||||
)
|
)
|
||||||
tdata.append(
|
tdata.append(
|
||||||
[FontFallbackParagraph(self._normalize(pgettext('invoice', 'Outstanding payments')), self.stylesheet['Bold'])] +
|
[PlainTextParagraph(pgettext('invoice', 'Outstanding payments'), self.stylesheet['Bold'])] +
|
||||||
(['', '', ''] if has_taxes else ['']) +
|
(['', '', ''] if has_taxes else ['']) +
|
||||||
[money_filter(pending_sum, self.invoice.event.currency)]
|
[money_filter(pending_sum, self.invoice.event.currency)]
|
||||||
)
|
)
|
||||||
@@ -980,12 +969,12 @@ class ClassicInvoiceRenderer(BaseReportlabInvoiceRenderer):
|
|||||||
s=Sum('amount')
|
s=Sum('amount')
|
||||||
)['s'] or Decimal('0.00')
|
)['s'] or Decimal('0.00')
|
||||||
tdata.append(
|
tdata.append(
|
||||||
[FontFallbackParagraph(self._normalize(pgettext('invoice', 'Paid by gift card')), self.stylesheet['Normal'])] +
|
[PlainTextParagraph(pgettext('invoice', 'Paid by gift card'), self.stylesheet['Normal'])] +
|
||||||
(['', '', ''] if has_taxes else ['']) +
|
(['', '', ''] if has_taxes else ['']) +
|
||||||
[money_filter(giftcard_sum, self.invoice.event.currency)]
|
[money_filter(giftcard_sum, self.invoice.event.currency)]
|
||||||
)
|
)
|
||||||
tdata.append(
|
tdata.append(
|
||||||
[FontFallbackParagraph(self._normalize(pgettext('invoice', 'Remaining amount')), self.stylesheet['Bold'])] +
|
[PlainTextParagraph(pgettext('invoice', 'Remaining amount'), self.stylesheet['Bold'])] +
|
||||||
(['', '', ''] if has_taxes else ['']) +
|
(['', '', ''] if has_taxes else ['']) +
|
||||||
[money_filter(total - giftcard_sum, self.invoice.event.currency)]
|
[money_filter(total - giftcard_sum, self.invoice.event.currency)]
|
||||||
)
|
)
|
||||||
@@ -1008,14 +997,14 @@ class ClassicInvoiceRenderer(BaseReportlabInvoiceRenderer):
|
|||||||
story.append(Spacer(1, 10 * mm))
|
story.append(Spacer(1, 10 * mm))
|
||||||
|
|
||||||
if request_show_service_date:
|
if request_show_service_date:
|
||||||
story.append(FontFallbackParagraph(
|
story.append(PlainTextParagraph(
|
||||||
self._normalize(pgettext('invoice', 'Invoice period: {daterange}').format(daterange=request_show_service_date)),
|
pgettext('invoice', 'Invoice period: {daterange}').format(daterange=request_show_service_date),
|
||||||
self.stylesheet['Normal']
|
self.stylesheet['Normal']
|
||||||
))
|
))
|
||||||
|
|
||||||
if self.invoice.payment_provider_text:
|
if self.invoice.payment_provider_text:
|
||||||
story.append(FontFallbackParagraph(
|
story.append(FontFallbackParagraph(
|
||||||
self._normalize(self.invoice.payment_provider_text),
|
self._clean_text(self.invoice.payment_provider_text, tags=['br', 'b']),
|
||||||
self.stylesheet['Normal']
|
self.stylesheet['Normal']
|
||||||
))
|
))
|
||||||
|
|
||||||
@@ -1039,10 +1028,10 @@ class ClassicInvoiceRenderer(BaseReportlabInvoiceRenderer):
|
|||||||
('FONTNAME', (0, 0), (-1, -1), self.font_regular),
|
('FONTNAME', (0, 0), (-1, -1), self.font_regular),
|
||||||
]
|
]
|
||||||
thead = [
|
thead = [
|
||||||
FontFallbackParagraph(self._normalize(pgettext('invoice', 'Tax rate')), self.stylesheet['Fineprint']),
|
PlainTextParagraph(pgettext('invoice', 'Tax rate'), self.stylesheet['Fineprint']),
|
||||||
FontFallbackParagraph(self._normalize(pgettext('invoice', 'Net value')), self.stylesheet['FineprintRight']),
|
PlainTextParagraph(pgettext('invoice', 'Net value'), self.stylesheet['FineprintRight']),
|
||||||
FontFallbackParagraph(self._normalize(pgettext('invoice', 'Gross value')), self.stylesheet['FineprintRight']),
|
PlainTextParagraph(pgettext('invoice', 'Gross value'), self.stylesheet['FineprintRight']),
|
||||||
FontFallbackParagraph(self._normalize(pgettext('invoice', 'Tax')), self.stylesheet['FineprintRight']),
|
PlainTextParagraph(pgettext('invoice', 'Tax'), self.stylesheet['FineprintRight']),
|
||||||
''
|
''
|
||||||
]
|
]
|
||||||
tdata = [thead]
|
tdata = [thead]
|
||||||
@@ -1053,7 +1042,7 @@ class ClassicInvoiceRenderer(BaseReportlabInvoiceRenderer):
|
|||||||
continue
|
continue
|
||||||
tax = taxvalue_map[idx]
|
tax = taxvalue_map[idx]
|
||||||
tdata.append([
|
tdata.append([
|
||||||
FontFallbackParagraph(self._normalize(localize(rate) + " % " + name), self.stylesheet['Fineprint']),
|
PlainTextParagraph(localize(rate) + " % " + name, self.stylesheet['Fineprint']),
|
||||||
money_filter(gross - tax, self.invoice.event.currency),
|
money_filter(gross - tax, self.invoice.event.currency),
|
||||||
money_filter(gross, self.invoice.event.currency),
|
money_filter(gross, self.invoice.event.currency),
|
||||||
money_filter(tax, self.invoice.event.currency),
|
money_filter(tax, self.invoice.event.currency),
|
||||||
@@ -1072,7 +1061,7 @@ class ClassicInvoiceRenderer(BaseReportlabInvoiceRenderer):
|
|||||||
table.setStyle(TableStyle(tstyledata))
|
table.setStyle(TableStyle(tstyledata))
|
||||||
story.append(Spacer(5 * mm, 5 * mm))
|
story.append(Spacer(5 * mm, 5 * mm))
|
||||||
story.append(KeepTogether([
|
story.append(KeepTogether([
|
||||||
FontFallbackParagraph(self._normalize(pgettext('invoice', 'Included taxes')), self.stylesheet['FineprintHeading']),
|
PlainTextParagraph(pgettext('invoice', 'Included taxes'), self.stylesheet['FineprintHeading']),
|
||||||
table
|
table
|
||||||
]))
|
]))
|
||||||
|
|
||||||
@@ -1089,7 +1078,7 @@ class ClassicInvoiceRenderer(BaseReportlabInvoiceRenderer):
|
|||||||
net = gross - tax
|
net = gross - tax
|
||||||
|
|
||||||
tdata.append([
|
tdata.append([
|
||||||
FontFallbackParagraph(self._normalize(localize(rate) + " % " + name), self.stylesheet['Fineprint']),
|
PlainTextParagraph(localize(rate) + " % " + name, self.stylesheet['Fineprint']),
|
||||||
fmt(net), fmt(gross), fmt(tax), ''
|
fmt(net), fmt(gross), fmt(tax), ''
|
||||||
])
|
])
|
||||||
|
|
||||||
@@ -1098,13 +1087,13 @@ class ClassicInvoiceRenderer(BaseReportlabInvoiceRenderer):
|
|||||||
|
|
||||||
story.append(KeepTogether([
|
story.append(KeepTogether([
|
||||||
Spacer(1, height=2 * mm),
|
Spacer(1, height=2 * mm),
|
||||||
FontFallbackParagraph(
|
PlainTextParagraph(
|
||||||
self._normalize(pgettext(
|
pgettext(
|
||||||
'invoice', 'Using the conversion rate of 1:{rate} as published by the {authority} on '
|
'invoice', 'Using the conversion rate of 1:{rate} as published by the {authority} on '
|
||||||
'{date}, this corresponds to:'
|
'{date}, this corresponds to:'
|
||||||
).format(rate=localize(self.invoice.foreign_currency_rate),
|
).format(rate=localize(self.invoice.foreign_currency_rate),
|
||||||
authority=SOURCE_NAMES.get(self.invoice.foreign_currency_source, "?"),
|
authority=SOURCE_NAMES.get(self.invoice.foreign_currency_source, "?"),
|
||||||
date=date_format(self.invoice.foreign_currency_rate_date, "SHORT_DATE_FORMAT"))),
|
date=date_format(self.invoice.foreign_currency_rate_date, "SHORT_DATE_FORMAT")),
|
||||||
self.stylesheet['Fineprint']
|
self.stylesheet['Fineprint']
|
||||||
),
|
),
|
||||||
Spacer(1, height=3 * mm),
|
Spacer(1, height=3 * mm),
|
||||||
@@ -1113,14 +1102,14 @@ class ClassicInvoiceRenderer(BaseReportlabInvoiceRenderer):
|
|||||||
elif self.invoice.foreign_currency_display and self.invoice.foreign_currency_rate:
|
elif self.invoice.foreign_currency_display and self.invoice.foreign_currency_rate:
|
||||||
foreign_total = round_decimal(total * self.invoice.foreign_currency_rate)
|
foreign_total = round_decimal(total * self.invoice.foreign_currency_rate)
|
||||||
story.append(Spacer(1, 5 * mm))
|
story.append(Spacer(1, 5 * mm))
|
||||||
story.append(FontFallbackParagraph(self._normalize(
|
story.append(PlainTextParagraph(
|
||||||
pgettext(
|
pgettext(
|
||||||
'invoice', 'Using the conversion rate of 1:{rate} as published by the {authority} on '
|
'invoice', 'Using the conversion rate of 1:{rate} as published by the {authority} on '
|
||||||
'{date}, the invoice total corresponds to {total}.'
|
'{date}, the invoice total corresponds to {total}.'
|
||||||
).format(rate=localize(self.invoice.foreign_currency_rate),
|
).format(rate=localize(self.invoice.foreign_currency_rate),
|
||||||
date=date_format(self.invoice.foreign_currency_rate_date, "SHORT_DATE_FORMAT"),
|
date=date_format(self.invoice.foreign_currency_rate_date, "SHORT_DATE_FORMAT"),
|
||||||
authority=SOURCE_NAMES.get(self.invoice.foreign_currency_source, "?"),
|
authority=SOURCE_NAMES.get(self.invoice.foreign_currency_source, "?"),
|
||||||
total=fmt(foreign_total))),
|
total=fmt(foreign_total)),
|
||||||
self.stylesheet['Fineprint']
|
self.stylesheet['Fineprint']
|
||||||
))
|
))
|
||||||
|
|
||||||
@@ -1162,11 +1151,8 @@ class Modern1Renderer(ClassicInvoiceRenderer):
|
|||||||
def _draw_invoice_from(self, canvas):
|
def _draw_invoice_from(self, canvas):
|
||||||
if not self.invoice.invoice_from:
|
if not self.invoice.invoice_from:
|
||||||
return
|
return
|
||||||
c = [
|
c = self.invoice.address_invoice_from.strip().split('\n')
|
||||||
self._clean_text(l)
|
p = PlainTextParagraph(' · '.join(c), style=self.stylesheet['Sender'])
|
||||||
for l in self.invoice.address_invoice_from.strip().split('\n')
|
|
||||||
]
|
|
||||||
p = FontFallbackParagraph(self._normalize(' · '.join(c)), style=self.stylesheet['Sender'])
|
|
||||||
p.wrapOn(canvas, self.invoice_to_width, 15.7 * mm)
|
p.wrapOn(canvas, self.invoice_to_width, 15.7 * mm)
|
||||||
p.drawOn(canvas, self.invoice_to_left, self.pagesize[1] - self.invoice_to_top + 2 * mm)
|
p.drawOn(canvas, self.invoice_to_left, self.pagesize[1] - self.invoice_to_top + 2 * mm)
|
||||||
super()._draw_invoice_from(canvas)
|
super()._draw_invoice_from(canvas)
|
||||||
@@ -1225,8 +1211,8 @@ class Modern1Renderer(ClassicInvoiceRenderer):
|
|||||||
_draw(pgettext('invoice', 'Order code'), self.invoice.order.full_code, value_size, self.left_margin, 45 * mm, **kwargs)
|
_draw(pgettext('invoice', 'Order code'), self.invoice.order.full_code, value_size, self.left_margin, 45 * mm, **kwargs)
|
||||||
]
|
]
|
||||||
|
|
||||||
p = FontFallbackParagraph(
|
p = PlainTextParagraph(
|
||||||
self._normalize(date_format(self.invoice.date, "DATE_FORMAT")),
|
date_format(self.invoice.date, "DATE_FORMAT"),
|
||||||
style=ParagraphStyle(name=f'Normal{value_size}', fontName=self.font_regular, fontSize=value_size, leading=value_size * 1.2)
|
style=ParagraphStyle(name=f'Normal{value_size}', fontName=self.font_regular, fontSize=value_size, leading=value_size * 1.2)
|
||||||
)
|
)
|
||||||
w = stringWidth(p.text, p.frags[0].fontName, p.frags[0].fontSize)
|
w = stringWidth(p.text, p.frags[0].fontName, p.frags[0].fontSize)
|
||||||
@@ -1283,7 +1269,7 @@ class Modern1SimplifiedRenderer(Modern1Renderer):
|
|||||||
i = []
|
i = []
|
||||||
|
|
||||||
if not self.invoice.event.has_subevents and self.invoice.event.settings.show_dates_on_frontpage:
|
if not self.invoice.event.has_subevents and self.invoice.event.settings.show_dates_on_frontpage:
|
||||||
i.append(FontFallbackParagraph(
|
i.append(PlainTextParagraph(
|
||||||
pgettext('invoice', 'Event date: {date_range}').format(
|
pgettext('invoice', 'Event date: {date_range}').format(
|
||||||
date_range=self.invoice.event.get_date_range_display(),
|
date_range=self.invoice.event.get_date_range_display(),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -36,8 +36,9 @@ from django.core.management.commands.makemigrations import Command as Parent
|
|||||||
|
|
||||||
from ._migrations import monkeypatch_migrations
|
from ._migrations import monkeypatch_migrations
|
||||||
|
|
||||||
monkeypatch_migrations()
|
|
||||||
|
|
||||||
|
|
||||||
class Command(Parent):
|
class Command(Parent):
|
||||||
pass
|
|
||||||
|
def handle(self, *args, **kwargs):
|
||||||
|
monkeypatch_migrations()
|
||||||
|
return super().handle(*args, **kwargs)
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ class Command(BaseCommand):
|
|||||||
if not periodic_task.receivers or periodic_task.sender_receivers_cache.get(self) is NO_RECEIVERS:
|
if not periodic_task.receivers or periodic_task.sender_receivers_cache.get(self) is NO_RECEIVERS:
|
||||||
return
|
return
|
||||||
|
|
||||||
for receiver in periodic_task._live_receivers(self):
|
for receiver in periodic_task._live_receivers(self)[0]:
|
||||||
name = f'{receiver.__module__}.{receiver.__name__}'
|
name = f'{receiver.__module__}.{receiver.__name__}'
|
||||||
if options['list_tasks']:
|
if options['list_tasks']:
|
||||||
print(name)
|
print(name)
|
||||||
|
|||||||
@@ -41,16 +41,20 @@ class Migration(migrations.Migration):
|
|||||||
name='datetime',
|
name='datetime',
|
||||||
field=models.DateTimeField(),
|
field=models.DateTimeField(),
|
||||||
),
|
),
|
||||||
migrations.AlterIndexTogether(
|
migrations.AddIndex(
|
||||||
name='logentry',
|
'logentry',
|
||||||
index_together={('datetime', 'id')},
|
models.Index(fields=('datetime', 'id'), name="pretixbase__datetim_b1fe5a_idx"),
|
||||||
),
|
),
|
||||||
migrations.AlterIndexTogether(
|
migrations.AddIndex(
|
||||||
name='order',
|
'order',
|
||||||
index_together={('datetime', 'id'), ('last_modified', 'id')},
|
models.Index(fields=["datetime", "id"], name="pretixbase__datetim_66aff0_idx"),
|
||||||
),
|
),
|
||||||
migrations.AlterIndexTogether(
|
migrations.AddIndex(
|
||||||
name='transaction',
|
'order',
|
||||||
index_together={('datetime', 'id')},
|
models.Index(fields=["last_modified", "id"], name="pretixbase__last_mo_4ebf8b_idx"),
|
||||||
|
),
|
||||||
|
migrations.AddIndex(
|
||||||
|
'transaction',
|
||||||
|
models.Index(fields=('datetime', 'id'), name="pretixbase__datetim_b20405_idx"),
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -61,7 +61,10 @@ class Migration(migrations.Migration):
|
|||||||
options={
|
options={
|
||||||
'ordering': ('identifier', 'type', 'organizer'),
|
'ordering': ('identifier', 'type', 'organizer'),
|
||||||
'unique_together': {('identifier', 'type', 'organizer')},
|
'unique_together': {('identifier', 'type', 'organizer')},
|
||||||
'index_together': {('identifier', 'type', 'organizer'), ('updated', 'id')},
|
'indexes': [
|
||||||
|
models.Index(fields=('identifier', 'type', 'organizer'), name='reusable_medium_organizer_index'),
|
||||||
|
models.Index(fields=('updated', 'id'), name="pretixbase__updated_093277_idx")
|
||||||
|
],
|
||||||
},
|
},
|
||||||
bases=(models.Model, pretix.base.models.base.LoggingMixin),
|
bases=(models.Model, pretix.base.models.base.LoggingMixin),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -9,31 +9,6 @@ class Migration(migrations.Migration):
|
|||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
migrations.RenameIndex(
|
|
||||||
model_name="logentry",
|
|
||||||
new_name="pretixbase__datetim_b1fe5a_idx",
|
|
||||||
old_fields=("datetime", "id"),
|
|
||||||
),
|
|
||||||
migrations.RenameIndex(
|
|
||||||
model_name="order",
|
|
||||||
new_name="pretixbase__datetim_66aff0_idx",
|
|
||||||
old_fields=("datetime", "id"),
|
|
||||||
),
|
|
||||||
migrations.RenameIndex(
|
|
||||||
model_name="order",
|
|
||||||
new_name="pretixbase__last_mo_4ebf8b_idx",
|
|
||||||
old_fields=("last_modified", "id"),
|
|
||||||
),
|
|
||||||
migrations.RenameIndex(
|
|
||||||
model_name="reusablemedium",
|
|
||||||
new_name="pretixbase__updated_093277_idx",
|
|
||||||
old_fields=("updated", "id"),
|
|
||||||
),
|
|
||||||
migrations.RenameIndex(
|
|
||||||
model_name="transaction",
|
|
||||||
new_name="pretixbase__datetim_b20405_idx",
|
|
||||||
old_fields=("datetime", "id"),
|
|
||||||
),
|
|
||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name="attendeeprofile",
|
model_name="attendeeprofile",
|
||||||
name="id",
|
name="id",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# Generated by Django 4.2.10 on 2024-04-02 15:16
|
# Generated by Django 4.2.10 on 2024-04-02 15:16
|
||||||
|
|
||||||
from django.db import migrations
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
@@ -10,8 +10,8 @@ class Migration(migrations.Migration):
|
|||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
migrations.AlterIndexTogether(
|
migrations.RemoveIndex(
|
||||||
name="reusablemedium",
|
"reusablemedium",
|
||||||
index_together=set(),
|
'reusable_medium_organizer_index',
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ class LogEntry(models.Model):
|
|||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
ordering = ('-datetime', '-id')
|
ordering = ('-datetime', '-id')
|
||||||
indexes = [models.Index(fields=["datetime", "id"])]
|
indexes = [models.Index(fields=["datetime", "id"], name="pretixbase__datetim_b1fe5a_idx")]
|
||||||
|
|
||||||
def display(self):
|
def display(self):
|
||||||
from pretix.base.logentrytype_registry import log_entry_types
|
from pretix.base.logentrytype_registry import log_entry_types
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ class ReusableMedium(LoggedModel):
|
|||||||
class Meta:
|
class Meta:
|
||||||
unique_together = (("identifier", "type", "organizer"),)
|
unique_together = (("identifier", "type", "organizer"),)
|
||||||
indexes = [
|
indexes = [
|
||||||
models.Index(fields=("updated", "id")),
|
models.Index(fields=("updated", "id"), name="pretixbase__updated_093277_idx"),
|
||||||
]
|
]
|
||||||
ordering = "identifier", "type", "organizer"
|
ordering = "identifier", "type", "organizer"
|
||||||
|
|
||||||
|
|||||||
@@ -336,8 +336,8 @@ class Order(LockModel, LoggedModel):
|
|||||||
verbose_name_plural = _("Orders")
|
verbose_name_plural = _("Orders")
|
||||||
ordering = ("-datetime", "-pk")
|
ordering = ("-datetime", "-pk")
|
||||||
indexes = [
|
indexes = [
|
||||||
models.Index(fields=["datetime", "id"]),
|
models.Index(fields=["datetime", "id"], name="pretixbase__datetim_66aff0_idx"),
|
||||||
models.Index(fields=["last_modified", "id"]),
|
models.Index(fields=["last_modified", "id"], name="pretixbase__last_mo_4ebf8b_idx"),
|
||||||
]
|
]
|
||||||
constraints = [
|
constraints = [
|
||||||
models.UniqueConstraint(fields=["organizer", "code"], name="order_organizer_code_uniq"),
|
models.UniqueConstraint(fields=["organizer", "code"], name="order_organizer_code_uniq"),
|
||||||
@@ -3080,7 +3080,7 @@ class Transaction(models.Model):
|
|||||||
class Meta:
|
class Meta:
|
||||||
ordering = 'datetime', 'pk'
|
ordering = 'datetime', 'pk'
|
||||||
indexes = [
|
indexes = [
|
||||||
models.Index(fields=['datetime', 'id'])
|
models.Index(fields=['datetime', 'id'], name="pretixbase__datetim_b20405_idx")
|
||||||
]
|
]
|
||||||
|
|
||||||
def save(self, *args, **kwargs):
|
def save(self, *args, **kwargs):
|
||||||
|
|||||||
@@ -1045,7 +1045,7 @@ class Renderer:
|
|||||||
except:
|
except:
|
||||||
logger.exception('Reshaping/Bidi fixes failed on string {}'.format(repr(text)))
|
logger.exception('Reshaping/Bidi fixes failed on string {}'.format(repr(text)))
|
||||||
|
|
||||||
p = Paragraph(text, style=style)
|
p = Paragraph(text, style=style) # not using AutoEscapeParagraph is safe as we escape above
|
||||||
return p, ad, lineheight
|
return p, ad, lineheight
|
||||||
|
|
||||||
def _draw_textcontainer(self, canvas: Canvas, op: OrderPosition, order: Order, o: dict):
|
def _draw_textcontainer(self, canvas: Canvas, op: OrderPosition, order: Order, o: dict):
|
||||||
|
|||||||
@@ -411,7 +411,7 @@ def mail_send_task(self, **kwargs) -> bool:
|
|||||||
try:
|
try:
|
||||||
outgoing_mail = OutgoingMail.objects.select_for_update(of=OF_SELF).get(pk=outgoing_mail)
|
outgoing_mail = OutgoingMail.objects.select_for_update(of=OF_SELF).get(pk=outgoing_mail)
|
||||||
except OutgoingMail.DoesNotExist:
|
except OutgoingMail.DoesNotExist:
|
||||||
logger.info(f"Ignoring job for non existing email {outgoing_mail.guid}")
|
logger.info(f"Ignoring job for non existing email {outgoing_mail}")
|
||||||
return False
|
return False
|
||||||
if outgoing_mail.status == OutgoingMail.STATUS_INFLIGHT:
|
if outgoing_mail.status == OutgoingMail.STATUS_INFLIGHT:
|
||||||
logger.info(f"Ignoring job for inflight email {outgoing_mail.guid}")
|
logger.info(f"Ignoring job for inflight email {outgoing_mail.guid}")
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ def primary_font_kwargs():
|
|||||||
|
|
||||||
choices = [('Open Sans', 'Open Sans')]
|
choices = [('Open Sans', 'Open Sans')]
|
||||||
choices += sorted([
|
choices += sorted([
|
||||||
(a, {"title": a, "data": v}) for a, v in get_fonts(pdf_support_required=False).items()
|
(a, FontSelect.FontOption(title=a, data=v)) for a, v in get_fonts(pdf_support_required=False).items()
|
||||||
], key=lambda a: a[0])
|
], key=lambda a: a[0])
|
||||||
return {
|
return {
|
||||||
'choices': choices,
|
'choices': choices,
|
||||||
@@ -4148,6 +4148,14 @@ def validate_event_settings(event, settings_dict):
|
|||||||
)
|
)
|
||||||
]}
|
]}
|
||||||
)
|
)
|
||||||
|
if (
|
||||||
|
settings_dict.get('invoice_address_from_vat_id') and
|
||||||
|
settings_dict.get('invoice_address_from_country') and
|
||||||
|
settings_dict.get('invoice_address_from_country') not in VAT_ID_COUNTRIES
|
||||||
|
):
|
||||||
|
raise ValidationError({
|
||||||
|
'invoice_address_from_vat_id': _('VAT-ID is not supported for "{}".').format(settings_dict.get('invoice_address_from_country'))
|
||||||
|
})
|
||||||
|
|
||||||
payment_term_last = settings_dict.get('payment_term_last')
|
payment_term_last = settings_dict.get('payment_term_last')
|
||||||
if payment_term_last and event.presale_end:
|
if payment_term_last and event.presale_end:
|
||||||
|
|||||||
+60
-19
@@ -32,6 +32,7 @@
|
|||||||
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
# License for the specific language governing permissions and limitations under the License.
|
# License for the specific language governing permissions and limitations under the License.
|
||||||
|
|
||||||
|
import logging
|
||||||
import warnings
|
import warnings
|
||||||
from typing import Any, Callable, Generic, List, Tuple, TypeVar
|
from typing import Any, Callable, Generic, List, Tuple, TypeVar
|
||||||
|
|
||||||
@@ -48,6 +49,8 @@ from .plugins import (
|
|||||||
PLUGIN_LEVEL_ORGANIZER,
|
PLUGIN_LEVEL_ORGANIZER,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
app_cache = {}
|
app_cache = {}
|
||||||
T = TypeVar('T')
|
T = TypeVar('T')
|
||||||
|
|
||||||
@@ -60,23 +63,25 @@ def _populate_app_cache():
|
|||||||
|
|
||||||
def get_defining_app(o):
|
def get_defining_app(o):
|
||||||
# If sentry packed this in a wrapper, unpack that
|
# If sentry packed this in a wrapper, unpack that
|
||||||
if "sentry" in o.__module__:
|
module = getattr(o, "__module__", None)
|
||||||
|
if module and "sentry" in module:
|
||||||
o = o.__wrapped__
|
o = o.__wrapped__
|
||||||
|
|
||||||
if hasattr(o, "__mocked_app"):
|
if hasattr(o, "__mocked_app"):
|
||||||
return o.__mocked_app
|
return o.__mocked_app
|
||||||
|
|
||||||
# Find the Django application this belongs to
|
# Find the Django application this belongs to
|
||||||
searchpath = o.__module__
|
searchpath = module or getattr(o.__class__, "__module__", None) or ""
|
||||||
|
|
||||||
# Core modules are always active
|
# Core modules are always active
|
||||||
if any(searchpath.startswith(cm) for cm in settings.CORE_MODULES):
|
if searchpath and any(searchpath.startswith(cm) for cm in settings.CORE_MODULES):
|
||||||
return 'CORE'
|
return 'CORE'
|
||||||
|
|
||||||
if not app_cache:
|
if not app_cache:
|
||||||
_populate_app_cache()
|
_populate_app_cache()
|
||||||
|
|
||||||
while True:
|
app = None
|
||||||
|
while searchpath:
|
||||||
app = app_cache.get(searchpath)
|
app = app_cache.get(searchpath)
|
||||||
if "." not in searchpath or app:
|
if "." not in searchpath or app:
|
||||||
break
|
break
|
||||||
@@ -157,7 +162,7 @@ class PluginSignal(Generic[T], django.dispatch.Signal):
|
|||||||
if not app_cache:
|
if not app_cache:
|
||||||
_populate_app_cache()
|
_populate_app_cache()
|
||||||
|
|
||||||
for receiver in self._sorted_receivers(sender):
|
for receiver in self._live_receivers(sender)[0]:
|
||||||
if self._is_receiver_active(sender, receiver):
|
if self._is_receiver_active(sender, receiver):
|
||||||
response = receiver(signal=self, sender=sender, **named)
|
response = receiver(signal=self, sender=sender, **named)
|
||||||
responses.append((receiver, response))
|
responses.append((receiver, response))
|
||||||
@@ -179,7 +184,7 @@ class PluginSignal(Generic[T], django.dispatch.Signal):
|
|||||||
if not app_cache:
|
if not app_cache:
|
||||||
_populate_app_cache()
|
_populate_app_cache()
|
||||||
|
|
||||||
for receiver in self._sorted_receivers(sender):
|
for receiver in self._live_receivers(sender)[0]:
|
||||||
if self._is_receiver_active(sender, receiver):
|
if self._is_receiver_active(sender, receiver):
|
||||||
named[chain_kwarg_name] = response
|
named[chain_kwarg_name] = response
|
||||||
response = receiver(signal=self, sender=sender, **named)
|
response = receiver(signal=self, sender=sender, **named)
|
||||||
@@ -204,7 +209,7 @@ class PluginSignal(Generic[T], django.dispatch.Signal):
|
|||||||
if not app_cache:
|
if not app_cache:
|
||||||
_populate_app_cache()
|
_populate_app_cache()
|
||||||
|
|
||||||
for receiver in self._sorted_receivers(sender):
|
for receiver in self._live_receivers(sender)[0]:
|
||||||
if self._is_receiver_active(sender, receiver):
|
if self._is_receiver_active(sender, receiver):
|
||||||
try:
|
try:
|
||||||
response = receiver(signal=self, sender=sender, **named)
|
response = receiver(signal=self, sender=sender, **named)
|
||||||
@@ -214,17 +219,35 @@ class PluginSignal(Generic[T], django.dispatch.Signal):
|
|||||||
responses.append((receiver, response))
|
responses.append((receiver, response))
|
||||||
return responses
|
return responses
|
||||||
|
|
||||||
def _sorted_receivers(self, sender):
|
def asend(self, sender: T, **named):
|
||||||
orig_list = self._live_receivers(sender)
|
raise NotImplementedError() # NOQA
|
||||||
|
|
||||||
|
def asend_robust(self, sender: T, **named):
|
||||||
|
raise NotImplementedError() # NOQA
|
||||||
|
|
||||||
|
def _live_receivers(self, sender):
|
||||||
|
orig_list, orig_async_list = super()._live_receivers(sender)
|
||||||
|
|
||||||
|
if orig_async_list:
|
||||||
|
logger.error('Async receivers are not supported.')
|
||||||
|
raise NotImplementedError
|
||||||
|
|
||||||
|
def _getattr_fallback_to_class(obj, key):
|
||||||
|
return getattr(obj, key, getattr(obj.__class__, key))
|
||||||
|
|
||||||
|
def _is_core_module(receiver):
|
||||||
|
m = _getattr_fallback_to_class(receiver, "__module__")
|
||||||
|
return any(m.startswith(c) for c in settings.CORE_MODULES)
|
||||||
|
|
||||||
sorted_list = sorted(
|
sorted_list = sorted(
|
||||||
orig_list,
|
orig_list,
|
||||||
key=lambda receiver: (
|
key=lambda receiver: (
|
||||||
0 if any(receiver.__module__.startswith(m) for m in settings.CORE_MODULES) else 1,
|
0 if _is_core_module(receiver) else 1,
|
||||||
receiver.__module__,
|
_getattr_fallback_to_class(receiver, "__module__"),
|
||||||
receiver.__name__,
|
_getattr_fallback_to_class(receiver, "__name__"),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
return sorted_list
|
return sorted_list, []
|
||||||
|
|
||||||
|
|
||||||
class EventPluginSignal(PluginSignal[Event]):
|
class EventPluginSignal(PluginSignal[Event]):
|
||||||
@@ -300,23 +323,41 @@ class GlobalSignal(django.dispatch.Signal):
|
|||||||
if not self.receivers or self.sender_receivers_cache.get(sender) is NO_RECEIVERS:
|
if not self.receivers or self.sender_receivers_cache.get(sender) is NO_RECEIVERS:
|
||||||
return response
|
return response
|
||||||
|
|
||||||
for receiver in self._live_receivers(sender):
|
for receiver in self._live_receivers(sender)[0]:
|
||||||
named[chain_kwarg_name] = response
|
named[chain_kwarg_name] = response
|
||||||
response = receiver(signal=self, sender=sender, **named)
|
response = receiver(signal=self, sender=sender, **named)
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
def asend(self, sender: T, **named):
|
||||||
|
raise NotImplementedError() # NOQA
|
||||||
|
|
||||||
|
def asend_robust(self, sender: T, **named):
|
||||||
|
raise NotImplementedError() # NOQA
|
||||||
|
|
||||||
def _live_receivers(self, sender):
|
def _live_receivers(self, sender):
|
||||||
# Ensure consistent sorting of receivers
|
# Ensure consistent sorting of receivers
|
||||||
orig_list = super()._live_receivers(sender)
|
orig_list, orig_async_list = super()._live_receivers(sender)
|
||||||
|
|
||||||
|
if orig_async_list:
|
||||||
|
logger.error('Async receivers are not supported.')
|
||||||
|
raise NotImplementedError
|
||||||
|
|
||||||
|
def _getattr_fallback_to_class(obj, key):
|
||||||
|
return getattr(obj, key, getattr(obj.__class__, key))
|
||||||
|
|
||||||
|
def _is_core_module(receiver):
|
||||||
|
m = _getattr_fallback_to_class(receiver, "__module__")
|
||||||
|
return any(m.startswith(c) for c in settings.CORE_MODULES)
|
||||||
|
|
||||||
sorted_list = sorted(
|
sorted_list = sorted(
|
||||||
orig_list,
|
orig_list,
|
||||||
key=lambda receiver: (
|
key=lambda receiver: (
|
||||||
0 if any(receiver.__module__.startswith(m) for m in settings.CORE_MODULES) else 1,
|
0 if _is_core_module(receiver) else 1,
|
||||||
receiver.__module__,
|
_getattr_fallback_to_class(receiver, "__module__"),
|
||||||
receiver.__name__,
|
_getattr_fallback_to_class(receiver, "__name__"),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
return sorted_list
|
return sorted_list, []
|
||||||
|
|
||||||
|
|
||||||
class DeprecatedSignal(GlobalSignal):
|
class DeprecatedSignal(GlobalSignal):
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
{% extends "error.html" %}
|
||||||
|
{% load i18n %}
|
||||||
|
{% load eventurl %}
|
||||||
|
{% load urlreplace %}
|
||||||
|
{% load static %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<h1>{% trans "Please continue in a new tab" %}</h1>
|
||||||
|
<p class="larger">
|
||||||
|
{% blocktrans trimmed %}
|
||||||
|
For security reasons, the following step is only possible in a new tab.
|
||||||
|
{% endblocktrans %}
|
||||||
|
</p>
|
||||||
|
<p class="larger">
|
||||||
|
{% blocktrans trimmed %}
|
||||||
|
If the new tab did not open automatically, please click the following button:
|
||||||
|
{% endblocktrans %}
|
||||||
|
</p>
|
||||||
|
<div class="text-center">
|
||||||
|
<a href="{{ url }}"
|
||||||
|
class="btn btn-primary btn-lg" target="_blank">
|
||||||
|
<span class="fa fa-external-link-square"></span>
|
||||||
|
{% trans "Continue in new tab" %}
|
||||||
|
</a>
|
||||||
|
{{ url|json_script:"framebreak-url" }}
|
||||||
|
<script type="text/javascript" src="{% static "pretixbase/js/framebreak.js" %}"></script>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
@@ -2,13 +2,14 @@
|
|||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
{% load rich_text %}
|
{% load rich_text %}
|
||||||
{% load static %}
|
{% load static %}
|
||||||
|
{% load wrap_in %}
|
||||||
{% block title %}{% trans "Redirect" %}{% endblock %}
|
{% block title %}{% trans "Redirect" %}{% endblock %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<i class="fa fa-link fa-fw big-icon"></i>
|
<i class="fa fa-link fa-fw big-icon"></i>
|
||||||
<div class="error-details">
|
<div class="error-details">
|
||||||
<h1>{% trans "Redirect" %}</h1>
|
<h1>{% trans "Redirect" %}</h1>
|
||||||
<h3>
|
<h3>
|
||||||
{% blocktrans trimmed with host="<strong>"|add:hostname|add:"</strong>"|safe %}
|
{% blocktrans trimmed with host=hostname|wrap_in:'strong' %}
|
||||||
The link you clicked on wants to redirect you to a destination on the website {{ host }}.
|
The link you clicked on wants to redirect you to a destination on the website {{ host }}.
|
||||||
{% endblocktrans %}
|
{% endblocktrans %}
|
||||||
{% blocktrans trimmed %}
|
{% blocktrans trimmed %}
|
||||||
|
|||||||
@@ -42,8 +42,6 @@ from bleach import DEFAULT_CALLBACKS, html5lib_shim
|
|||||||
from bleach.linkifier import build_email_re
|
from bleach.linkifier import build_email_re
|
||||||
from django import template
|
from django import template
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.core import signing
|
|
||||||
from django.urls import reverse
|
|
||||||
from django.utils.functional import SimpleLazyObject
|
from django.utils.functional import SimpleLazyObject
|
||||||
from django.utils.html import escape
|
from django.utils.html import escape
|
||||||
from django.utils.http import url_has_allowed_host_and_scheme
|
from django.utils.http import url_has_allowed_host_and_scheme
|
||||||
@@ -54,6 +52,7 @@ from markdown.postprocessors import Postprocessor
|
|||||||
from markdown.treeprocessors import UnescapeTreeprocessor
|
from markdown.treeprocessors import UnescapeTreeprocessor
|
||||||
from tlds import tld_set
|
from tlds import tld_set
|
||||||
|
|
||||||
|
from pretix.base.views.redirect import safelink
|
||||||
from pretix.helpers.format import SafeFormatter, format_map
|
from pretix.helpers.format import SafeFormatter, format_map
|
||||||
|
|
||||||
register = template.Library()
|
register = template.Library()
|
||||||
@@ -158,8 +157,7 @@ def safelink_callback(attrs, new=False):
|
|||||||
"""
|
"""
|
||||||
url = html.unescape(attrs.get((None, 'href'), '/'))
|
url = html.unescape(attrs.get((None, 'href'), '/'))
|
||||||
if not url_has_allowed_host_and_scheme(url, allowed_hosts=None) and not url.startswith('mailto:') and not url.startswith('tel:'):
|
if not url_has_allowed_host_and_scheme(url, allowed_hosts=None) and not url.startswith('mailto:') and not url.startswith('tel:'):
|
||||||
signer = signing.Signer(salt='safe-redirect')
|
attrs[None, 'href'] = safelink(url)
|
||||||
attrs[None, 'href'] = reverse('redirect') + '?url=' + urllib.parse.quote(signer.sign(url))
|
|
||||||
attrs[None, 'target'] = '_blank'
|
attrs[None, 'target'] = '_blank'
|
||||||
attrs[None, 'rel'] = 'noopener'
|
attrs[None, 'rel'] = 'noopener'
|
||||||
return attrs
|
return attrs
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
# You should have received a copy of the GNU Affero General Public License along with this program. If not, see
|
# You should have received a copy of the GNU Affero General Public License along with this program. If not, see
|
||||||
# <https://www.gnu.org/licenses/>.
|
# <https://www.gnu.org/licenses/>.
|
||||||
#
|
#
|
||||||
|
import logging
|
||||||
import urllib.parse
|
import urllib.parse
|
||||||
|
|
||||||
from django.core import signing
|
from django.core import signing
|
||||||
@@ -26,6 +27,8 @@ from django.http import HttpResponseBadRequest, HttpResponseRedirect
|
|||||||
from django.shortcuts import render
|
from django.shortcuts import render
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
|
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
def _is_samesite_referer(request):
|
def _is_samesite_referer(request):
|
||||||
referer = request.headers.get('referer')
|
referer = request.headers.get('referer')
|
||||||
@@ -42,11 +45,16 @@ def _is_samesite_referer(request):
|
|||||||
|
|
||||||
|
|
||||||
def redir_view(request):
|
def redir_view(request):
|
||||||
signer = signing.Signer(salt='safe-redirect')
|
framebreak = "framebreak" in request.GET
|
||||||
|
salt = 'framebreak-safelink-url' if framebreak else 'safelink-url'
|
||||||
try:
|
try:
|
||||||
url = signer.unsign(request.GET.get('url', ''))
|
url = signing.Signer(salt=salt).unsign(request.GET.get('url', ''))
|
||||||
except signing.BadSignature:
|
except signing.BadSignature:
|
||||||
return HttpResponseBadRequest('Invalid parameter')
|
try:
|
||||||
|
# Backwards-compatibility for a change in 2026-06, remove after a while
|
||||||
|
url = signing.Signer(salt='safe-redirect').unsign(request.GET.get('url', ''))
|
||||||
|
except signing.BadSignature:
|
||||||
|
return HttpResponseBadRequest('Invalid parameter')
|
||||||
|
|
||||||
if not _is_samesite_referer(request):
|
if not _is_samesite_referer(request):
|
||||||
u = urllib.parse.urlparse(url)
|
u = urllib.parse.urlparse(url)
|
||||||
@@ -55,11 +63,26 @@ def redir_view(request):
|
|||||||
'url': url,
|
'url': url,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if framebreak:
|
||||||
|
r = render(request, 'pretixbase/framebreak.html', {
|
||||||
|
'url': url,
|
||||||
|
})
|
||||||
|
r.xframe_options_exempt = True
|
||||||
|
return r
|
||||||
|
|
||||||
r = HttpResponseRedirect(url)
|
r = HttpResponseRedirect(url)
|
||||||
r['X-Robots-Tag'] = 'noindex'
|
r['X-Robots-Tag'] = 'noindex'
|
||||||
return r
|
return r
|
||||||
|
|
||||||
|
|
||||||
def safelink(url):
|
def safelink(url, framebreak=False):
|
||||||
signer = signing.Signer(salt='safe-redirect')
|
url = str(url)
|
||||||
return reverse('redirect') + '?url=' + urllib.parse.quote(signer.sign(url))
|
if not (url.startswith('https://') or url.startswith('http://') or url.startswith("/")):
|
||||||
|
logger.warning('Invalid URL passed to safelink: %r', url)
|
||||||
|
return '#invalid-url'
|
||||||
|
salt = 'framebreak-safelink-url' if framebreak else 'safelink-url'
|
||||||
|
signer = signing.Signer(salt=salt)
|
||||||
|
u = reverse('redirect') + '?url=' + urllib.parse.quote(signer.sign(url))
|
||||||
|
if framebreak:
|
||||||
|
u += "&framebreak=true"
|
||||||
|
return u
|
||||||
|
|||||||
@@ -34,6 +34,7 @@
|
|||||||
|
|
||||||
import datetime
|
import datetime
|
||||||
import os
|
import os
|
||||||
|
from dataclasses import dataclass
|
||||||
|
|
||||||
from django import forms
|
from django import forms
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
@@ -420,6 +421,11 @@ class SplitDateTimeField(forms.SplitDateTimeField):
|
|||||||
class FontSelect(forms.RadioSelect):
|
class FontSelect(forms.RadioSelect):
|
||||||
option_template_name = 'pretixcontrol/font_option.html'
|
option_template_name = 'pretixcontrol/font_option.html'
|
||||||
|
|
||||||
|
@dataclass
|
||||||
|
class FontOption:
|
||||||
|
title: str
|
||||||
|
data: str
|
||||||
|
|
||||||
|
|
||||||
class ItemMultipleChoiceField(SafeModelMultipleChoiceField):
|
class ItemMultipleChoiceField(SafeModelMultipleChoiceField):
|
||||||
def label_from_instance(self, obj):
|
def label_from_instance(self, obj):
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ from pretix.base.forms import (
|
|||||||
from pretix.base.models import Event, Organizer, TaxRule, Team
|
from pretix.base.models import Event, Organizer, TaxRule, Team
|
||||||
from pretix.base.models.event import EventFooterLink, EventMetaValue, SubEvent
|
from pretix.base.models.event import EventFooterLink, EventMetaValue, SubEvent
|
||||||
from pretix.base.models.organizer import TeamQuerySet
|
from pretix.base.models.organizer import TeamQuerySet
|
||||||
from pretix.base.models.tax import TAX_CODE_LISTS
|
from pretix.base.models.tax import TAX_CODE_LISTS, VAT_ID_COUNTRIES
|
||||||
from pretix.base.reldate import RelativeDateField, RelativeDateTimeField
|
from pretix.base.reldate import RelativeDateField, RelativeDateTimeField
|
||||||
from pretix.base.services.placeholders import FormPlaceholderMixin
|
from pretix.base.services.placeholders import FormPlaceholderMixin
|
||||||
from pretix.base.settings import (
|
from pretix.base.settings import (
|
||||||
@@ -73,8 +73,8 @@ from pretix.base.settings import (
|
|||||||
)
|
)
|
||||||
from pretix.base.validators import multimail_validate
|
from pretix.base.validators import multimail_validate
|
||||||
from pretix.control.forms import (
|
from pretix.control.forms import (
|
||||||
MultipleLanguagesWidget, SalesChannelCheckboxSelectMultiple, SlugWidget,
|
FontSelect, MultipleLanguagesWidget, SalesChannelCheckboxSelectMultiple,
|
||||||
SplitDateTimeField, SplitDateTimePickerWidget,
|
SlugWidget, SplitDateTimeField, SplitDateTimePickerWidget,
|
||||||
)
|
)
|
||||||
from pretix.control.forms.widgets import Select2
|
from pretix.control.forms.widgets import Select2
|
||||||
from pretix.helpers.countries import CachedCountries
|
from pretix.helpers.countries import CachedCountries
|
||||||
@@ -531,6 +531,13 @@ class EventUpdateForm(I18nModelForm):
|
|||||||
|
|
||||||
class EventSettingsValidationMixin:
|
class EventSettingsValidationMixin:
|
||||||
|
|
||||||
|
def clean_invoice_address_from_vat_id(self):
|
||||||
|
value = self.cleaned_data.get('invoice_address_from_vat_id')
|
||||||
|
country = self.cleaned_data.get('invoice_address_from_country')
|
||||||
|
if value and country and country not in VAT_ID_COUNTRIES:
|
||||||
|
return None
|
||||||
|
return value
|
||||||
|
|
||||||
def clean(self):
|
def clean(self):
|
||||||
data = super().clean()
|
data = super().clean()
|
||||||
settings_dict = self.obj.settings.freeze()
|
settings_dict = self.obj.settings.freeze()
|
||||||
@@ -722,7 +729,7 @@ class EventSettingsForm(EventSettingsValidationMixin, FormPlaceholderMixin, Sett
|
|||||||
del self.fields['event_list_filters']
|
del self.fields['event_list_filters']
|
||||||
del self.fields['event_calendar_future_only']
|
del self.fields['event_calendar_future_only']
|
||||||
self.fields['primary_font'].choices = [('Open Sans', 'Open Sans')] + sorted([
|
self.fields['primary_font'].choices = [('Open Sans', 'Open Sans')] + sorted([
|
||||||
(a, {"title": a, "data": v}) for a, v in get_fonts(self.event, pdf_support_required=False).items()
|
(a, FontSelect.FontOption(title=a, data=v)) for a, v in get_fonts(self.event, pdf_support_required=False).items()
|
||||||
], key=lambda a: a[0])
|
], key=lambda a: a[0])
|
||||||
|
|
||||||
# create "virtual" fields for better UX when editing <name>_asked and <name>_required fields
|
# create "virtual" fields for better UX when editing <name>_asked and <name>_required fields
|
||||||
|
|||||||
@@ -212,7 +212,7 @@ class AuditLogMiddleware:
|
|||||||
if request.path.startswith(get_script_prefix() + 'control') and request.user.is_authenticated:
|
if request.path.startswith(get_script_prefix() + 'control') and request.user.is_authenticated:
|
||||||
if getattr(request.user, "is_hijacked", False):
|
if getattr(request.user, "is_hijacked", False):
|
||||||
hijack_history = request.session.get('hijack_history', False)
|
hijack_history = request.session.get('hijack_history', False)
|
||||||
hijacker = get_object_or_404(User, pk=hijack_history[0])
|
hijacker = get_object_or_404(User, pk=hijack_history[0]["user"])
|
||||||
ss = hijacker.get_active_staff_session(request.session.get('hijacker_session'))
|
ss = hijacker.get_active_staff_session(request.session.get('hijacker_session'))
|
||||||
if ss:
|
if ss:
|
||||||
ss.logs.create(
|
ss.logs.create(
|
||||||
|
|||||||
@@ -363,7 +363,7 @@ def get_global_navigation(request):
|
|||||||
'icon': 'dashboard',
|
'icon': 'dashboard',
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
if request.user.is_in_any_teams:
|
if request.user.is_in_any_teams or request.user.is_staff:
|
||||||
nav += [
|
nav += [
|
||||||
{
|
{
|
||||||
'label': _('Events'),
|
'label': _('Events'),
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ from pretix import __version__
|
|||||||
from pretix.base.models import Order, OrderPayment, Transaction
|
from pretix.base.models import Order, OrderPayment, Transaction
|
||||||
from pretix.base.plugins import get_all_plugins
|
from pretix.base.plugins import get_all_plugins
|
||||||
from pretix.base.templatetags.money import money_filter
|
from pretix.base.templatetags.money import money_filter
|
||||||
|
from pretix.helpers.reportlab import PlainTextParagraph
|
||||||
from pretix.plugins.reports.exporters import ReportlabExportMixin
|
from pretix.plugins.reports.exporters import ReportlabExportMixin
|
||||||
from pretix.settings import DATA_DIR
|
from pretix.settings import DATA_DIR
|
||||||
|
|
||||||
@@ -79,23 +80,23 @@ class SysReport(ReportlabExportMixin):
|
|||||||
style_small.fontSize = 6
|
style_small.fontSize = 6
|
||||||
|
|
||||||
story = [
|
story = [
|
||||||
Paragraph("System report", headlinestyle),
|
PlainTextParagraph("System report", headlinestyle),
|
||||||
Spacer(1, 5 * mm),
|
Spacer(1, 5 * mm),
|
||||||
Paragraph("Usage", subheadlinestyle),
|
PlainTextParagraph("Usage", subheadlinestyle),
|
||||||
Spacer(1, 5 * mm),
|
Spacer(1, 5 * mm),
|
||||||
self._usage_table(),
|
self._usage_table(),
|
||||||
Spacer(1, 5 * mm),
|
Spacer(1, 5 * mm),
|
||||||
Paragraph("Installed versions", subheadlinestyle),
|
PlainTextParagraph("Installed versions", subheadlinestyle),
|
||||||
Spacer(1, 5 * mm),
|
Spacer(1, 5 * mm),
|
||||||
self._tech_table(),
|
self._tech_table(),
|
||||||
Spacer(1, 5 * mm),
|
Spacer(1, 5 * mm),
|
||||||
Paragraph("Plugins", subheadlinestyle),
|
PlainTextParagraph("Plugins", subheadlinestyle),
|
||||||
Spacer(1, 5 * mm),
|
Spacer(1, 5 * mm),
|
||||||
Paragraph(self._get_plugin_versions(), style_small),
|
PlainTextParagraph(self._get_plugin_versions(), style_small),
|
||||||
Spacer(1, 5 * mm),
|
Spacer(1, 5 * mm),
|
||||||
Paragraph("Custom templates", subheadlinestyle),
|
PlainTextParagraph("Custom templates", subheadlinestyle),
|
||||||
Spacer(1, 5 * mm),
|
Spacer(1, 5 * mm),
|
||||||
Paragraph(self._get_custom_templates(), style_small),
|
PlainTextParagraph(self._get_custom_templates(), style_small),
|
||||||
Spacer(1, 5 * mm),
|
Spacer(1, 5 * mm),
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -121,13 +122,13 @@ class SysReport(ReportlabExportMixin):
|
|||||||
("RIGHTPADDING", (-1, 0), (-1, -1), 0),
|
("RIGHTPADDING", (-1, 0), (-1, -1), 0),
|
||||||
]
|
]
|
||||||
tdata = [
|
tdata = [
|
||||||
[Paragraph("Site URL:", style), Paragraph(settings.SITE_URL, style)],
|
[PlainTextParagraph("Site URL:", style), Paragraph(settings.SITE_URL, style)],
|
||||||
[Paragraph("pretix version:", style), Paragraph(__version__, style)],
|
[PlainTextParagraph("pretix version:", style), Paragraph(__version__, style)],
|
||||||
[Paragraph("Python version:", style), Paragraph(sys.version, style)],
|
[PlainTextParagraph("Python version:", style), Paragraph(sys.version, style)],
|
||||||
[Paragraph("Platform:", style), Paragraph(platform.platform(), style)],
|
[PlainTextParagraph("Platform:", style), Paragraph(platform.platform(), style)],
|
||||||
[
|
[
|
||||||
Paragraph("Database engine:", style),
|
PlainTextParagraph("Database engine:", style),
|
||||||
Paragraph(settings.DATABASES["default"]["ENGINE"], style),
|
PlainTextParagraph(settings.DATABASES["default"]["ENGINE"], style),
|
||||||
],
|
],
|
||||||
]
|
]
|
||||||
table = Table(tdata, colWidths=colwidths, repeatRows=0)
|
table = Table(tdata, colWidths=colwidths, repeatRows=0)
|
||||||
@@ -206,7 +207,7 @@ class SysReport(ReportlabExportMixin):
|
|||||||
year_last = now().year
|
year_last = now().year
|
||||||
tdata = [
|
tdata = [
|
||||||
[
|
[
|
||||||
Paragraph(l, style_small_head)
|
PlainTextParagraph(l, style_small_head)
|
||||||
for l in (
|
for l in (
|
||||||
"Time frame",
|
"Time frame",
|
||||||
"Currency",
|
"Currency",
|
||||||
@@ -257,19 +258,19 @@ class SysReport(ReportlabExportMixin):
|
|||||||
|
|
||||||
tdata.append(
|
tdata.append(
|
||||||
(
|
(
|
||||||
Paragraph(
|
PlainTextParagraph(
|
||||||
date_format(first_day, "M Y")
|
date_format(first_day, "M Y")
|
||||||
+ " – "
|
+ " – "
|
||||||
+ date_format(after_day - timedelta(days=1), "M Y"),
|
+ date_format(after_day - timedelta(days=1), "M Y"),
|
||||||
style_small,
|
style_small,
|
||||||
),
|
),
|
||||||
Paragraph(c, style_small),
|
PlainTextParagraph(c, style_small),
|
||||||
Paragraph(str(orders_count), style_small) if i == 0 else "",
|
PlainTextParagraph(str(orders_count), style_small) if i == 0 else "",
|
||||||
Paragraph(money_filter(revenue_data.get("s_net") or 0, c), style_small),
|
PlainTextParagraph(money_filter(revenue_data.get("s_net") or 0, c), style_small),
|
||||||
Paragraph(str(testmode_count), style_small) if i == 0 else "",
|
PlainTextParagraph(str(testmode_count), style_small) if i == 0 else "",
|
||||||
Paragraph(str(unconfirmed_count), style_small) if i == 0 else "",
|
PlainTextParagraph(str(unconfirmed_count), style_small) if i == 0 else "",
|
||||||
Paragraph(str(revenue_data.get("c") or 0), style_small),
|
PlainTextParagraph(str(revenue_data.get("c") or 0), style_small),
|
||||||
Paragraph(money_filter(revenue_data.get("s_gross") or 0, c), style_small),
|
PlainTextParagraph(money_filter(revenue_data.get("s_gross") or 0, c), style_small),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -19,9 +19,7 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
</h1>
|
</h1>
|
||||||
|
|
||||||
<script type="application/json" id="editor-data">
|
{{ layout|json_script:"editor-data" }}
|
||||||
{{ layout|safe }}
|
|
||||||
</script>
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-9">
|
<div class="col-md-9">
|
||||||
<div class="panel panel-default panel-pdf-editor">
|
<div class="panel panel-default panel-pdf-editor">
|
||||||
|
|||||||
@@ -6,35 +6,44 @@
|
|||||||
<h1>{% trans "Add a two-factor authentication device" %}</h1>
|
<h1>{% trans "Add a two-factor authentication device" %}</h1>
|
||||||
<form action="" method="post" class="form-horizontal">
|
<form action="" method="post" class="form-horizontal">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<input type="hidden" name="flow_token" value="{{ flow_token }}">
|
|
||||||
{% bootstrap_form_errors form %}
|
{% bootstrap_form_errors form %}
|
||||||
{% bootstrap_field form.name layout='horizontal' %}
|
{% bootstrap_field form.name layout='horizontal' %}
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group{% if form.devicetype.errors %} has-error{% endif %}">
|
||||||
<label class="col-md-3 control-label">{% trans "Device type" %}</label>
|
<label class="col-md-3 control-label">{% trans "Device type" %}</label>
|
||||||
<div class="col-md-9">
|
<div class="col-md-9">
|
||||||
<div class="big-radio radio">
|
<div>
|
||||||
<label>
|
<div class="big-radio radio">
|
||||||
<input type="radio" value="totp" name="{{ form.devicetype.html_name }}" {% if form.devicetype.value == "totp" %}checked{% endif %}>
|
<label>
|
||||||
<strong>{% trans "Smartphone with the Authenticator application" %}</strong><br>
|
<input type="radio" required value="totp" name="{{ form.devicetype.html_name }}" {% if form.devicetype.value == "totp" %}checked{% endif %}>
|
||||||
<div class="help-block">
|
<strong>{% trans "Smartphone with Authenticator app" %}</strong><br>
|
||||||
{% blocktrans trimmed %}
|
<div class="help-block">
|
||||||
Use your smartphone with any Time-based One-Time-Password app like freeOTP, Google Authenticator or Proton Authenticator.
|
{% blocktrans trimmed %}
|
||||||
{% endblocktrans %}
|
Use your smartphone with any Time-based One-Time-Password app like freeOTP, Google Authenticator or Proton Authenticator.
|
||||||
</div>
|
{% endblocktrans %}
|
||||||
</label>
|
</div>
|
||||||
</div>
|
</label>
|
||||||
<div class="big-radio radio">
|
</div>
|
||||||
<label>
|
<div class="big-radio radio">
|
||||||
<input type="radio" value="webauthn" name="{{ form.devicetype.html_name }}" {% if form.devicetype.value == "webauthn" %}checked{% endif %}>
|
<label>
|
||||||
<strong>{% trans "WebAuthn-compatible hardware token" %}</strong><br>
|
<input type="radio" required value="webauthn" name="{{ form.devicetype.html_name }}" {% if form.devicetype.value == "webauthn" %}checked{% endif %}>
|
||||||
<div class="help-block">
|
<strong>{% trans "WebAuthn-compatible hardware token" %}</strong><br>
|
||||||
{% blocktrans trimmed %}
|
<div class="help-block">
|
||||||
Use a hardware token like the Yubikey, or biometric authentication on iOS, macOS and Android.
|
{% blocktrans trimmed %}
|
||||||
{% endblocktrans %}
|
Use a hardware token like the Yubikey, or other biometric authentication like fingerprint or face recognition.
|
||||||
</div>
|
{% endblocktrans %}
|
||||||
</label>
|
</div>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{% if form.devicetype.errors %}
|
||||||
|
<div class="help-block">
|
||||||
|
{% for error in form.devicetype.errors %}
|
||||||
|
<p>{{ error|escape }}</p>
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -69,11 +69,14 @@
|
|||||||
{% trans "Enter the displayed code here:" %}
|
{% trans "Enter the displayed code here:" %}
|
||||||
<form class="form form-inline" method="post" action="">
|
<form class="form form-inline" method="post" action="">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<input type="hidden" name="flow_token" value="{{ flow_token }}">
|
|
||||||
<input type="number" name="token" class="form-control" required="required">
|
<input type="number" name="token" class="form-control" required="required">
|
||||||
<button class="btn btn-primary" type="submit">
|
<button class="btn btn-primary" type="submit">
|
||||||
{% trans "Continue" %}
|
{% trans "Continue" %}
|
||||||
</button><br>
|
</button><br>
|
||||||
|
<label>
|
||||||
|
<input type="checkbox" name="activate" checked="checked" value="on">
|
||||||
|
{% trans "Require second factor for future logins" %}
|
||||||
|
</label>
|
||||||
</form>
|
</form>
|
||||||
</li>
|
</li>
|
||||||
</ol>
|
</ol>
|
||||||
|
|||||||
@@ -12,9 +12,13 @@
|
|||||||
</p>
|
</p>
|
||||||
<form class="form form-inline" method="post" action="" id="webauthn-form">
|
<form class="form form-inline" method="post" action="" id="webauthn-form">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<input type="hidden" name="flow_token" value="{{ flow_token }}">
|
|
||||||
<input type="hidden" id="webauthn-response" name="token" class="form-control" required="required">
|
<input type="hidden" id="webauthn-response" name="token" class="form-control" required="required">
|
||||||
|
<p>
|
||||||
|
<label>
|
||||||
|
<input type="checkbox" name="activate" checked="checked" value="on">
|
||||||
|
{% trans "Require second factor for future logins" %}
|
||||||
|
</label>
|
||||||
|
</p>
|
||||||
<button class="btn btn-primary sr-only" type="submit"></button>
|
<button class="btn btn-primary sr-only" type="submit"></button>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,6 @@
|
|||||||
<h1>{% trans "Delete a two-factor authentication device" %}</h1>
|
<h1>{% trans "Delete a two-factor authentication device" %}</h1>
|
||||||
<form action="" method="post" class="form-horizontal">
|
<form action="" method="post" class="form-horizontal">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<input type="hidden" name="flow_token" value="{{ flow_token }}">
|
|
||||||
<p>{% blocktrans trimmed with device=device.name %}
|
<p>{% blocktrans trimmed with device=device.name %}
|
||||||
Are you sure you want to delete the authentication device "{{ device }}"?
|
Are you sure you want to delete the authentication device "{{ device }}"?
|
||||||
{% endblocktrans %}</p>
|
{% endblocktrans %}</p>
|
||||||
|
|||||||
@@ -6,7 +6,6 @@
|
|||||||
<h1>{% trans "Disable two-factor authentication" %}</h1>
|
<h1>{% trans "Disable two-factor authentication" %}</h1>
|
||||||
<form action="" method="post" class="form-horizontal">
|
<form action="" method="post" class="form-horizontal">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<input type="hidden" name="flow_token" value="{{ flow_token }}">
|
|
||||||
<p>
|
<p>
|
||||||
{% trans "Do you really want to disable two-factor authentication?" %}
|
{% trans "Do you really want to disable two-factor authentication?" %}
|
||||||
</p>
|
</p>
|
||||||
|
|||||||
@@ -1,58 +1,23 @@
|
|||||||
{% extends "pretixcontrol/base.html" %}
|
{% extends "pretixcontrol/base.html" %}
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
{% load bootstrap3 %}
|
{% load bootstrap3 %}
|
||||||
{% load icon %}
|
|
||||||
{% block title %}{% trans "Enable two-factor authentication" %}{% endblock %}
|
{% block title %}{% trans "Enable two-factor authentication" %}{% endblock %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h1>{% trans "Enable two-factor authentication" %}</h1>
|
<h1>{% trans "Enable two-factor authentication" %}</h1>
|
||||||
<form action="" method="post" class="form-horizontal">
|
<form action="" method="post" class="form-horizontal">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<input type="hidden" name="flow_token" value="{{ flow_token }}">
|
|
||||||
<p>
|
<p>
|
||||||
{% trans "Do you really want to enable two-factor authentication?" %}
|
{% trans "Do you really want to enable two-factor authentication?" %}
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
{% trans "You will no longer be able to log in to pretix without one of your configured devices." %}
|
{% trans "You will no longer be able to log in to pretix without one of your configured devices." %}
|
||||||
|
{% trans "Please make sure to print out or copy the emergency tokens and store them in a safe place." %}
|
||||||
</p>
|
</p>
|
||||||
{% if new_emergency_tokens %}
|
|
||||||
<div class="panel panel-default">
|
|
||||||
<div class="panel-heading">
|
|
||||||
<h3 class="panel-title">{% trans "Your emergency codes" %}</h3>
|
|
||||||
</div>
|
|
||||||
<div class="panel-body">
|
|
||||||
<p>
|
|
||||||
{% blocktrans trimmed %}
|
|
||||||
If you lose access to your devices, you can use one of your emergency tokens to log in.
|
|
||||||
We recommend to store them in a safe place, e.g. printed out or in a password manager.
|
|
||||||
Every token can be used at most once.
|
|
||||||
{% endblocktrans %}
|
|
||||||
</p>
|
|
||||||
<ul>
|
|
||||||
{% for code in new_emergency_tokens %}
|
|
||||||
<li>{{ code }}</li>
|
|
||||||
{% endfor %}
|
|
||||||
</ul>
|
|
||||||
<p>
|
|
||||||
<label>
|
|
||||||
<input type="checkbox" required>
|
|
||||||
{% trans "I stored my emergency tokens in a safe place." %}
|
|
||||||
</label>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% else %}
|
|
||||||
<p>
|
|
||||||
{% icon "info-circle" %}
|
|
||||||
{% blocktrans trimmed with generation_date_time=static_tokens_device.created_at %}
|
|
||||||
You generated your emergency tokens on {{ generation_date_time }}.
|
|
||||||
{% endblocktrans %}
|
|
||||||
</p>
|
|
||||||
{% endif %}
|
|
||||||
<div class="form-group submit-group">
|
<div class="form-group submit-group">
|
||||||
<a href="{% url "control:user.settings.2fa" %}" class="btn btn-default btn-cancel">
|
<a href="{% url "control:user.settings.2fa" %}" class="btn btn-default btn-cancel">
|
||||||
{% trans "Cancel" %}
|
{% trans "Cancel" %}
|
||||||
</a>
|
</a>
|
||||||
<button type="submit" class="btn btn-primary btn-save">
|
<button type="submit" class="btn btn-danger btn-save">
|
||||||
{% trans "Enable" %}
|
{% trans "Enable" %}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -6,7 +6,6 @@
|
|||||||
<h1>{% trans "Leave teams that require two-factor authentication" %}</h1>
|
<h1>{% trans "Leave teams that require two-factor authentication" %}</h1>
|
||||||
<form action="" method="post" class="form-horizontal">
|
<form action="" method="post" class="form-horizontal">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<input type="hidden" name="flow_token" value="{{ flow_token }}">
|
|
||||||
<p>
|
<p>
|
||||||
<strong>{% trans "Do you really want to leave the following teams?" %}</strong>
|
<strong>{% trans "Do you really want to leave the following teams?" %}</strong>
|
||||||
</p>
|
</p>
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
{% extends "pretixcontrol/base.html" %}
|
{% extends "pretixcontrol/base.html" %}
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
{% load icon %}
|
|
||||||
{% load bootstrap3 %}
|
{% load bootstrap3 %}
|
||||||
{% block title %}{% trans "Two-factor authentication" %}{% endblock %}
|
{% block title %}{% trans "Two-factor authentication" %}{% endblock %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
@@ -121,7 +120,7 @@
|
|||||||
Delete
|
Delete
|
||||||
</a>
|
</a>
|
||||||
{% if d.devicetype == "totp" %}
|
{% if d.devicetype == "totp" %}
|
||||||
<span class="fa fa-mobile fa-lg"></span>
|
<span class="fa fa-mobile"></span>
|
||||||
{% elif d.devicetype == "webauthn" %}
|
{% elif d.devicetype == "webauthn" %}
|
||||||
<span class="fa fa-usb"></span>
|
<span class="fa fa-usb"></span>
|
||||||
{% elif d.devicetype == "u2f" %}
|
{% elif d.devicetype == "u2f" %}
|
||||||
@@ -153,30 +152,19 @@
|
|||||||
</p>
|
</p>
|
||||||
{% if static_tokens_device %}
|
{% if static_tokens_device %}
|
||||||
<p>
|
<p>
|
||||||
{% icon "info-circle" %}
|
|
||||||
{% blocktrans trimmed with generation_date_time=static_tokens_device.created_at %}
|
{% blocktrans trimmed with generation_date_time=static_tokens_device.created_at %}
|
||||||
You generated your emergency tokens on {{ generation_date_time }}.
|
You generated your emergency tokens on {{ generation_date_time }}.
|
||||||
{% endblocktrans %}
|
{% endblocktrans %}
|
||||||
</p>
|
</p>
|
||||||
<a href="{% url "control:user.settings.2fa.regenemergency" %}" class="btn btn-default">
|
|
||||||
<span class="fa fa-refresh"></span>
|
|
||||||
{% trans "Generate new emergency tokens" %}
|
|
||||||
</a>
|
|
||||||
{% elif user.require_2fa %}
|
|
||||||
<p>
|
|
||||||
{% icon "warning" %}
|
|
||||||
<strong>{% trans "You don't have any emergency tokens yet." %}</strong>
|
|
||||||
</p>
|
|
||||||
<a href="{% url "control:user.settings.2fa.regenemergency" %}" class="btn btn-default">
|
|
||||||
<span class="fa fa-refresh"></span>
|
|
||||||
{% trans "Generate emergency tokens" %}
|
|
||||||
</a>
|
|
||||||
{% else %}
|
{% else %}
|
||||||
<p class="help-block">
|
<p>
|
||||||
{% icon "info-circle" %}
|
{% trans "You don't have any emergency tokens yet." %}
|
||||||
{% trans "Emergency tokens will be generated when you enable two-factor authentication." %}
|
|
||||||
</p>
|
</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
<a href="{% url "control:user.settings.2fa.regenemergency" %}" class="btn btn-default">
|
||||||
|
<span class="fa fa-refresh"></span>
|
||||||
|
{% trans "Generate new emergency tokens" %}
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
@@ -6,7 +6,6 @@
|
|||||||
<h1>{% trans "Regenerate emergency codes" %}</h1>
|
<h1>{% trans "Regenerate emergency codes" %}</h1>
|
||||||
<form action="" method="post" class="form-horizontal">
|
<form action="" method="post" class="form-horizontal">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<input type="hidden" name="flow_token" value="{{ flow_token }}">
|
|
||||||
<p>
|
<p>
|
||||||
{% trans "Do you really want to regenerate your emergency codes?" %}
|
{% trans "Do you really want to regenerate your emergency codes?" %}
|
||||||
</p>
|
</p>
|
||||||
|
|||||||
@@ -8,7 +8,6 @@
|
|||||||
{% trans "Change login email address" %}
|
{% trans "Change login email address" %}
|
||||||
</h1>
|
</h1>
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<input type="hidden" name="flow_token" value="{{ flow_token }}">
|
|
||||||
{% bootstrap_form_errors form %}
|
{% bootstrap_form_errors form %}
|
||||||
<p class="text-muted">
|
<p class="text-muted">
|
||||||
{% trans "This changes the email address used to login to your account, as well as where we send email notifications." %}
|
{% trans "This changes the email address used to login to your account, as well as where we send email notifications." %}
|
||||||
|
|||||||
@@ -9,7 +9,6 @@
|
|||||||
</h1>
|
</h1>
|
||||||
<br>
|
<br>
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<input type="hidden" name="flow_token" value="{{ flow_token }}">
|
|
||||||
{% bootstrap_form_errors form %}
|
{% bootstrap_form_errors form %}
|
||||||
{% bootstrap_field form.email %}
|
{% bootstrap_field form.email %}
|
||||||
{% bootstrap_field form.old_pw %}
|
{% bootstrap_field form.old_pw %}
|
||||||
|
|||||||
@@ -641,7 +641,7 @@ def user_index(request):
|
|||||||
|
|
||||||
ctx = {
|
ctx = {
|
||||||
'widgets': rearrange(widgets),
|
'widgets': rearrange(widgets),
|
||||||
'can_create_event': request.user.teams.with_organizer_permission("organizer.events:create").exists(),
|
'can_create_event': request.user.teams.with_organizer_permission("organizer.events:create").exists() or request.user.is_staff,
|
||||||
'upcoming': widgets_for_event_qs(
|
'upcoming': widgets_for_event_qs(
|
||||||
request,
|
request,
|
||||||
annotated_event_query(request, lazy=True).filter(
|
annotated_event_query(request, lazy=True).filter(
|
||||||
|
|||||||
@@ -289,7 +289,7 @@ class BaseEditorView(EventPermissionRequiredMixin, TemplateView):
|
|||||||
ctx['pdf'] = self.get_current_background()
|
ctx['pdf'] = self.get_current_background()
|
||||||
ctx['variables'] = self.get_variables()
|
ctx['variables'] = self.get_variables()
|
||||||
ctx['images'] = self.get_images()
|
ctx['images'] = self.get_images()
|
||||||
ctx['layout'] = json.dumps(self.get_current_layout())
|
ctx['layout'] = self.get_current_layout()
|
||||||
ctx['title'] = self.title
|
ctx['title'] = self.title
|
||||||
ctx['locales'] = [p for p in settings.LANGUAGES if p[0] in self.request.event.settings.locales]
|
ctx['locales'] = [p for p in settings.LANGUAGES if p[0] in self.request.event.settings.locales]
|
||||||
ctx['maxfilesize'] = self.maxfilesize
|
ctx['maxfilesize'] = self.maxfilesize
|
||||||
|
|||||||
@@ -89,31 +89,13 @@ logger = logging.getLogger(__name__)
|
|||||||
|
|
||||||
class RecentAuthenticationRequiredMixin:
|
class RecentAuthenticationRequiredMixin:
|
||||||
max_time = 900
|
max_time = 900
|
||||||
max_form_time = 900
|
|
||||||
|
|
||||||
@method_decorator(never_cache)
|
@method_decorator(never_cache)
|
||||||
def dispatch(self, request, *args, **kwargs):
|
def dispatch(self, request, *args, **kwargs):
|
||||||
auth_is_recent = time.time() - request.session.get('pretix_auth_login_time', 0) < self.max_time
|
tdelta = time.time() - request.session.get('pretix_auth_login_time', 0)
|
||||||
allowed_by_token = (
|
if tdelta > self.max_time:
|
||||||
request.session.pop('pretix_reauthed_flow_token', None) == request.POST.get('flow_token', '')
|
|
||||||
and request.session.pop('pretix_reauthed_flow_allowed_url', None) == request.get_full_path()
|
|
||||||
and time.time() - request.session.pop('pretix_reauthed_flow_start_time', 0) < self.max_form_time
|
|
||||||
)
|
|
||||||
if auth_is_recent or allowed_by_token:
|
|
||||||
return super().dispatch(request, *args, **kwargs)
|
|
||||||
else:
|
|
||||||
return redirect(reverse('control:user.reauth') + '?next=' + quote(request.get_full_path()))
|
return redirect(reverse('control:user.reauth') + '?next=' + quote(request.get_full_path()))
|
||||||
|
return super().dispatch(request, *args, **kwargs)
|
||||||
def get_flow_token(self):
|
|
||||||
self.request.session['pretix_reauthed_flow_allowed_url'] = self.request.get_full_path()
|
|
||||||
self.request.session['pretix_reauthed_flow_token'] = get_random_string(22)
|
|
||||||
self.request.session['pretix_reauthed_flow_start_time'] = time.time()
|
|
||||||
return self.request.session['pretix_reauthed_flow_token']
|
|
||||||
|
|
||||||
def get_context_data(self, **kwargs):
|
|
||||||
ctx = super().get_context_data()
|
|
||||||
ctx['flow_token'] = self.get_flow_token()
|
|
||||||
return ctx
|
|
||||||
|
|
||||||
|
|
||||||
class ReauthView(TemplateView):
|
class ReauthView(TemplateView):
|
||||||
@@ -301,7 +283,6 @@ class UserHistoryView(ListView):
|
|||||||
|
|
||||||
|
|
||||||
class User2FAMainView(RecentAuthenticationRequiredMixin, TemplateView):
|
class User2FAMainView(RecentAuthenticationRequiredMixin, TemplateView):
|
||||||
max_time = 7200
|
|
||||||
template_name = 'pretixcontrol/user/2fa_main.html'
|
template_name = 'pretixcontrol/user/2fa_main.html'
|
||||||
|
|
||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
@@ -484,15 +465,25 @@ class User2FADeviceConfirmWebAuthnView(RecentAuthenticationRequiredMixin, Templa
|
|||||||
notices = [
|
notices = [
|
||||||
_('A new two-factor authentication device has been added to your account.')
|
_('A new two-factor authentication device has been added to your account.')
|
||||||
]
|
]
|
||||||
|
activate = request.POST.get('activate', '')
|
||||||
|
if activate == 'on' and not self.request.user.require_2fa:
|
||||||
|
self.request.user.require_2fa = True
|
||||||
|
self.request.user.save()
|
||||||
|
self.request.user.log_action('pretix.user.settings.2fa.enabled', user=self.request.user)
|
||||||
|
notices.append(
|
||||||
|
_('Two-factor authentication has been enabled.')
|
||||||
|
)
|
||||||
self.request.user.send_security_notice(notices)
|
self.request.user.send_security_notice(notices)
|
||||||
self.request.user.update_session_token()
|
self.request.user.update_session_token()
|
||||||
update_session_auth_hash(self.request, self.request.user)
|
update_session_auth_hash(self.request, self.request.user)
|
||||||
|
|
||||||
messages.success(request, str(_('The device has been verified and can now be used.')))
|
note = ''
|
||||||
if self.request.user.require_2fa:
|
if not self.request.user.require_2fa:
|
||||||
return redirect(reverse('control:user.settings.2fa'))
|
note = ' ' + str(_('Please note that you still need to enable two-factor authentication for your '
|
||||||
else:
|
'account using the buttons below to make a second factor required for logging '
|
||||||
return redirect(reverse('control:user.settings.2fa.enable'))
|
'into your account.'))
|
||||||
|
messages.success(request, str(_('The device has been verified and can now be used.')) + note)
|
||||||
|
return redirect(reverse('control:user.settings.2fa'))
|
||||||
except Exception:
|
except Exception:
|
||||||
messages.error(request, _('The registration could not be completed. Please try again.'))
|
messages.error(request, _('The registration could not be completed. Please try again.'))
|
||||||
logger.exception('WebAuthn registration failed')
|
logger.exception('WebAuthn registration failed')
|
||||||
@@ -503,7 +494,6 @@ class User2FADeviceConfirmWebAuthnView(RecentAuthenticationRequiredMixin, Templa
|
|||||||
|
|
||||||
class User2FADeviceConfirmTOTPView(RecentAuthenticationRequiredMixin, TemplateView):
|
class User2FADeviceConfirmTOTPView(RecentAuthenticationRequiredMixin, TemplateView):
|
||||||
template_name = 'pretixcontrol/user/2fa_confirm_totp.html'
|
template_name = 'pretixcontrol/user/2fa_confirm_totp.html'
|
||||||
max_form_time = 7200 # this should have effectively no timeout, as the user might need to download the 2fa app first
|
|
||||||
|
|
||||||
@cached_property
|
@cached_property
|
||||||
def device(self):
|
def device(self):
|
||||||
@@ -524,6 +514,7 @@ class User2FADeviceConfirmTOTPView(RecentAuthenticationRequiredMixin, TemplateVi
|
|||||||
|
|
||||||
def post(self, request, *args, **kwargs):
|
def post(self, request, *args, **kwargs):
|
||||||
token = request.POST.get('token', '')
|
token = request.POST.get('token', '')
|
||||||
|
activate = request.POST.get('activate', '')
|
||||||
if self.device.verify_token(token):
|
if self.device.verify_token(token):
|
||||||
self.device.confirmed = True
|
self.device.confirmed = True
|
||||||
self.device.save()
|
self.device.save()
|
||||||
@@ -535,15 +526,24 @@ class User2FADeviceConfirmTOTPView(RecentAuthenticationRequiredMixin, TemplateVi
|
|||||||
notices = [
|
notices = [
|
||||||
_('A new two-factor authentication device has been added to your account.')
|
_('A new two-factor authentication device has been added to your account.')
|
||||||
]
|
]
|
||||||
|
if activate == 'on' and not self.request.user.require_2fa:
|
||||||
|
self.request.user.require_2fa = True
|
||||||
|
self.request.user.save()
|
||||||
|
self.request.user.log_action('pretix.user.settings.2fa.enabled', user=self.request.user)
|
||||||
|
notices.append(
|
||||||
|
_('Two-factor authentication has been enabled.')
|
||||||
|
)
|
||||||
self.request.user.send_security_notice(notices)
|
self.request.user.send_security_notice(notices)
|
||||||
self.request.user.update_session_token()
|
self.request.user.update_session_token()
|
||||||
update_session_auth_hash(self.request, self.request.user)
|
update_session_auth_hash(self.request, self.request.user)
|
||||||
|
|
||||||
messages.success(request, str(_('The device has been verified and can now be used.')))
|
note = ''
|
||||||
if self.request.user.require_2fa:
|
if not self.request.user.require_2fa:
|
||||||
return redirect(reverse('control:user.settings.2fa'))
|
note = ' ' + str(_('Please note that you still need to enable two-factor authentication for your '
|
||||||
else:
|
'account using the buttons below to make a second factor required for logging '
|
||||||
return redirect(reverse('control:user.settings.2fa.enable'))
|
'into your account.'))
|
||||||
|
messages.success(request, str(_('The device has been verified and can now be used.')) + note)
|
||||||
|
return redirect(reverse('control:user.settings.2fa'))
|
||||||
else:
|
else:
|
||||||
messages.error(request, _('The code you entered was not valid. If this problem persists, please check '
|
messages.error(request, _('The code you entered was not valid. If this problem persists, please check '
|
||||||
'that the date and time of your phone are configured correctly.'))
|
'that the date and time of your phone are configured correctly.'))
|
||||||
@@ -576,7 +576,6 @@ class User2FALeaveTeamsView(RecentAuthenticationRequiredMixin, TemplateView):
|
|||||||
|
|
||||||
class User2FAEnableView(RecentAuthenticationRequiredMixin, TemplateView):
|
class User2FAEnableView(RecentAuthenticationRequiredMixin, TemplateView):
|
||||||
template_name = 'pretixcontrol/user/2fa_enable.html'
|
template_name = 'pretixcontrol/user/2fa_enable.html'
|
||||||
max_form_time = 7200 # this should have effectively no timeout, as the user might take some time to print out their emergency codes, and they would become invalid in case of a timeout
|
|
||||||
|
|
||||||
def dispatch(self, request, *args, **kwargs):
|
def dispatch(self, request, *args, **kwargs):
|
||||||
if not any(dt.objects.filter(user=self.request.user, confirmed=True) for dt in REAL_DEVICE_TYPES):
|
if not any(dt.objects.filter(user=self.request.user, confirmed=True) for dt in REAL_DEVICE_TYPES):
|
||||||
@@ -585,39 +584,14 @@ class User2FAEnableView(RecentAuthenticationRequiredMixin, TemplateView):
|
|||||||
return redirect(reverse('control:user.settings.2fa'))
|
return redirect(reverse('control:user.settings.2fa'))
|
||||||
return super().dispatch(request, *args, **kwargs)
|
return super().dispatch(request, *args, **kwargs)
|
||||||
|
|
||||||
def get(self, request, *args, **kwargs):
|
|
||||||
new_tokens = None
|
|
||||||
try:
|
|
||||||
static_tokens_device = StaticDevice.objects.get(user=self.request.user, name='emergency')
|
|
||||||
except StaticDevice.MultipleObjectsReturned:
|
|
||||||
static_tokens_device = StaticDevice.objects.filter(
|
|
||||||
user=self.request.user, name='emergency'
|
|
||||||
).first()
|
|
||||||
except StaticDevice.DoesNotExist:
|
|
||||||
static_tokens_device = None
|
|
||||||
|
|
||||||
new_tokens = [get_random_string(length=12, allowed_chars='1234567890') for _ in range(10)]
|
|
||||||
request.session['pretix_2fa_new_emergency_tokens'] = new_tokens
|
|
||||||
return super().get(request, *args, new_emergency_tokens=new_tokens, static_tokens_device=static_tokens_device, **kwargs)
|
|
||||||
|
|
||||||
def post(self, request, *args, **kwargs):
|
def post(self, request, *args, **kwargs):
|
||||||
notices = [
|
|
||||||
_('Two-factor authentication has been enabled.')
|
|
||||||
]
|
|
||||||
if 'pretix_2fa_new_emergency_tokens' in request.session:
|
|
||||||
d = StaticDevice.objects.create(user=self.request.user, name='emergency')
|
|
||||||
for code in request.session['pretix_2fa_new_emergency_tokens']:
|
|
||||||
d.token_set.create(token=code)
|
|
||||||
self.request.user.log_action('pretix.user.settings.2fa.regenemergency', user=self.request.user)
|
|
||||||
notices += [
|
|
||||||
_('Your two-factor emergency codes have been regenerated.')
|
|
||||||
]
|
|
||||||
del request.session['pretix_2fa_new_emergency_tokens']
|
|
||||||
self.request.user.require_2fa = True
|
self.request.user.require_2fa = True
|
||||||
self.request.user.save()
|
self.request.user.save()
|
||||||
self.request.user.log_action('pretix.user.settings.2fa.enabled', user=self.request.user)
|
self.request.user.log_action('pretix.user.settings.2fa.enabled', user=self.request.user)
|
||||||
messages.success(request, _('Two-factor authentication is now enabled for your account.'))
|
messages.success(request, _('Two-factor authentication is now enabled for your account.'))
|
||||||
self.request.user.send_security_notice(notices)
|
self.request.user.send_security_notice([
|
||||||
|
_('Two-factor authentication has been enabled.')
|
||||||
|
])
|
||||||
self.request.user.update_session_token()
|
self.request.user.update_session_token()
|
||||||
update_session_auth_hash(self.request, self.request.user)
|
update_session_auth_hash(self.request, self.request.user)
|
||||||
return redirect(reverse('control:user.settings.2fa'))
|
return redirect(reverse('control:user.settings.2fa'))
|
||||||
|
|||||||
@@ -19,19 +19,22 @@
|
|||||||
# You should have received a copy of the GNU Affero General Public License along with this program. If not, see
|
# You should have received a copy of the GNU Affero General Public License along with this program. If not, see
|
||||||
# <https://www.gnu.org/licenses/>.
|
# <https://www.gnu.org/licenses/>.
|
||||||
#
|
#
|
||||||
|
import hmac
|
||||||
import json
|
import json
|
||||||
from contextlib import contextmanager
|
from contextlib import contextmanager
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.contrib import messages
|
from django.contrib import messages
|
||||||
from django.contrib.auth import (
|
from django.contrib.auth import (
|
||||||
BACKEND_SESSION_KEY, get_user_model, load_backend, login,
|
BACKEND_SESSION_KEY, HASH_SESSION_KEY, get_user_model, load_backend, login,
|
||||||
|
logout,
|
||||||
)
|
)
|
||||||
from django.contrib.auth.mixins import LoginRequiredMixin
|
from django.contrib.auth.mixins import LoginRequiredMixin
|
||||||
|
from django.contrib.auth.views import redirect_to_login
|
||||||
from django.db import transaction
|
from django.db import transaction
|
||||||
from django.shortcuts import get_object_or_404, redirect
|
from django.shortcuts import get_object_or_404, redirect
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from django.utils.crypto import get_random_string
|
from django.utils.crypto import get_random_string, salted_hmac
|
||||||
from django.utils.functional import cached_property
|
from django.utils.functional import cached_property
|
||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
from django.views import View
|
from django.views import View
|
||||||
@@ -230,7 +233,15 @@ class UserImpersonateView(AdministratorPermissionRequiredMixin, RecentAuthentica
|
|||||||
hijacked = self.object
|
hijacked = self.object
|
||||||
|
|
||||||
hijack_history = request.session.get("hijack_history", [])
|
hijack_history = request.session.get("hijack_history", [])
|
||||||
hijack_history.append(request.user._meta.pk.value_to_string(hijacker))
|
hijack_history.append({
|
||||||
|
"user": request.user.pk,
|
||||||
|
# We include the auth_hash, because it is unguessable. So should an attacker gain an attack vector to
|
||||||
|
# modify hijack_history, they can't just insert or change a user that shouldn't be there. We HMAC it
|
||||||
|
# again, though, since we also do not want the auth_hash of the admin user to be in the session of an
|
||||||
|
# unprivileged user to contain the risk if there is some leak of session data.
|
||||||
|
"auth_hash": salted_hmac(key_salt=b"hijack-history-hash", value=request.session[HASH_SESSION_KEY],
|
||||||
|
algorithm="sha256", secret=settings.SECRET_KEY).hexdigest(),
|
||||||
|
})
|
||||||
|
|
||||||
backend = get_used_backend(request)
|
backend = get_used_backend(request)
|
||||||
backend = f"{backend.__module__}.{backend.__class__.__name__}"
|
backend = f"{backend.__module__}.{backend.__class__.__name__}"
|
||||||
@@ -259,8 +270,21 @@ class UserImpersonateStopView(LoginRequiredMixin, View):
|
|||||||
hijs = request.session['hijacker_session']
|
hijs = request.session['hijacker_session']
|
||||||
hijack_history = request.session.get("hijack_history", [])
|
hijack_history = request.session.get("hijack_history", [])
|
||||||
hijacked = request.user
|
hijacked = request.user
|
||||||
user_pk = hijack_history.pop()
|
prev_session = hijack_history.pop()
|
||||||
hijacker = get_object_or_404(get_user_model(), pk=user_pk)
|
hijacker = get_object_or_404(get_user_model(), pk=prev_session["user"])
|
||||||
|
|
||||||
|
expected_hash = salted_hmac(
|
||||||
|
key_salt=b"hijack-history-hash",
|
||||||
|
value=hijacker.get_session_auth_hash(),
|
||||||
|
algorithm="sha256",
|
||||||
|
secret=settings.SECRET_KEY
|
||||||
|
).hexdigest()
|
||||||
|
if not hmac.compare_digest(expected_hash, prev_session["auth_hash"]):
|
||||||
|
# Could be an attacker-controlled hijack history, but could also be e.g. a password change of the admin user
|
||||||
|
# that happened during the hijack session
|
||||||
|
logout(request)
|
||||||
|
return redirect_to_login(request.get_full_path())
|
||||||
|
|
||||||
backend = get_used_backend(request)
|
backend = get_used_backend(request)
|
||||||
backend = f"{backend.__module__}.{backend.__class__.__name__}"
|
backend = f"{backend.__module__}.{backend.__class__.__name__}"
|
||||||
with signals.no_update_last_login(), keep_session_age(request.session):
|
with signals.no_update_last_login(), keep_session_age(request.session):
|
||||||
|
|||||||
@@ -29,3 +29,8 @@ class PretixHelpersConfig(AppConfig):
|
|||||||
def ready(self):
|
def ready(self):
|
||||||
from .monkeypatching import monkeypatch_all_at_ready
|
from .monkeypatching import monkeypatch_all_at_ready
|
||||||
monkeypatch_all_at_ready()
|
monkeypatch_all_at_ready()
|
||||||
|
|
||||||
|
# Ensure reportlab does not make any calls to the internet or the local disk
|
||||||
|
from reportlab import rl_config
|
||||||
|
rl_config.trustedHosts = []
|
||||||
|
rl_config.trustedSchemes = ['data']
|
||||||
|
|||||||
@@ -23,9 +23,12 @@ import types
|
|||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from http import cookies
|
from http import cookies
|
||||||
|
|
||||||
|
from django.core.exceptions import SuspiciousFileOperation
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
from requests.adapters import HTTPAdapter
|
from requests.adapters import HTTPAdapter
|
||||||
|
|
||||||
|
from pretix.helpers.reportlab import ThumbnailingImageReader
|
||||||
|
|
||||||
|
|
||||||
def monkeypatch_vobject_performance():
|
def monkeypatch_vobject_performance():
|
||||||
"""
|
"""
|
||||||
@@ -95,8 +98,26 @@ def monkeypatch_cookie_morsel():
|
|||||||
cookies.Morsel._reserved.setdefault("partitioned", "Partitioned")
|
cookies.Morsel._reserved.setdefault("partitioned", "Partitioned")
|
||||||
|
|
||||||
|
|
||||||
|
def monkeypatch_reportlab_imagereader():
|
||||||
|
from reportlab.lib import utils
|
||||||
|
old_init = utils.ImageReader.__init__
|
||||||
|
|
||||||
|
def new_init(self, fileName, ident=None): # noqa
|
||||||
|
if not isinstance(fileName, Image.Image) and not hasattr(fileName, 'read') and not hasattr(fileName, 'str'):
|
||||||
|
if not isinstance(self, ThumbnailingImageReader):
|
||||||
|
# ThumbnailingImageReader is only used by us explicitly and not by using <img> in html, so it is safe
|
||||||
|
raise SuspiciousFileOperation("reportlab should not be reading images from disk")
|
||||||
|
|
||||||
|
return types.MethodType(old_init, self)(
|
||||||
|
fileName, ident
|
||||||
|
)
|
||||||
|
|
||||||
|
utils.ImageReader.__init__ = new_init
|
||||||
|
|
||||||
|
|
||||||
def monkeypatch_all_at_ready():
|
def monkeypatch_all_at_ready():
|
||||||
monkeypatch_vobject_performance()
|
monkeypatch_vobject_performance()
|
||||||
monkeypatch_pillow_safer()
|
monkeypatch_pillow_safer()
|
||||||
monkeypatch_requests_timeout()
|
monkeypatch_requests_timeout()
|
||||||
monkeypatch_cookie_morsel()
|
monkeypatch_cookie_morsel()
|
||||||
|
monkeypatch_reportlab_imagereader()
|
||||||
|
|||||||
@@ -20,14 +20,19 @@
|
|||||||
# <https://www.gnu.org/licenses/>.
|
# <https://www.gnu.org/licenses/>.
|
||||||
#
|
#
|
||||||
import logging
|
import logging
|
||||||
|
import re
|
||||||
|
import unicodedata
|
||||||
|
|
||||||
from arabic_reshaper import ArabicReshaper
|
from arabic_reshaper import ArabicReshaper
|
||||||
|
from bidi import get_display
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.utils.functional import SimpleLazyObject
|
from django.utils.functional import SimpleLazyObject
|
||||||
|
from django.utils.html import escape
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
from reportlab.lib.styles import ParagraphStyle
|
from reportlab.lib.styles import ParagraphStyle
|
||||||
from reportlab.lib.utils import ImageReader
|
from reportlab.lib.utils import ImageReader
|
||||||
from reportlab.pdfbase import pdfmetrics
|
from reportlab.pdfbase import pdfmetrics
|
||||||
|
from reportlab.pdfbase.ttfonts import TTFont
|
||||||
from reportlab.platypus import Paragraph
|
from reportlab.platypus import Paragraph
|
||||||
|
|
||||||
from pretix.presale.style import get_fonts
|
from pretix.presale.style import get_fonts
|
||||||
@@ -70,6 +75,20 @@ reshaper = SimpleLazyObject(lambda: ArabicReshaper(configuration={
|
|||||||
}))
|
}))
|
||||||
|
|
||||||
|
|
||||||
|
def normalize_text(text: str) -> str:
|
||||||
|
# reportlab does not support unicode combination characters
|
||||||
|
# It's important we do this before we use ArabicReshaper
|
||||||
|
text = unicodedata.normalize("NFKC", text)
|
||||||
|
|
||||||
|
# reportlab does not support RTL, ligature-heavy scripts like Arabic. Therefore, we use ArabicReshaper
|
||||||
|
# to resolve all ligatures and python-bidi to switch RTL texts.
|
||||||
|
try:
|
||||||
|
text = "\n".join(get_display(reshaper.reshape(l)) for l in re.split("\n", text))
|
||||||
|
except:
|
||||||
|
logger.exception('Reshaping/Bidi fixes failed on string {}'.format(repr(text)))
|
||||||
|
return text
|
||||||
|
|
||||||
|
|
||||||
class FontFallbackParagraph(Paragraph):
|
class FontFallbackParagraph(Paragraph):
|
||||||
def __init__(self, text, style=None, *args, **kwargs):
|
def __init__(self, text, style=None, *args, **kwargs):
|
||||||
if style is None:
|
if style is None:
|
||||||
@@ -87,6 +106,8 @@ class FontFallbackParagraph(Paragraph):
|
|||||||
if not text:
|
if not text:
|
||||||
return True
|
return True
|
||||||
font = pdfmetrics.getFont(font_name)
|
font = pdfmetrics.getFont(font_name)
|
||||||
|
if not isinstance(font, TTFont):
|
||||||
|
return True
|
||||||
return all(
|
return all(
|
||||||
ord(c) in font.face.charToGlyph or not c.isprintable()
|
ord(c) in font.face.charToGlyph or not c.isprintable()
|
||||||
for c in text
|
for c in text
|
||||||
@@ -102,6 +123,24 @@ class FontFallbackParagraph(Paragraph):
|
|||||||
return family
|
return family
|
||||||
|
|
||||||
|
|
||||||
|
class PlainTextParagraph(FontFallbackParagraph):
|
||||||
|
def __init__(self, text, style=None, linebreaks=True, *args, **kwargs):
|
||||||
|
if not isinstance(text, str):
|
||||||
|
if hasattr(text, '__html__'):
|
||||||
|
raise ValueError("It is contradictory to pass escaped content to PlainTextParagraph")
|
||||||
|
text = str(text)
|
||||||
|
|
||||||
|
# Normalize unicode and apply reshaping
|
||||||
|
text = normalize_text(text)
|
||||||
|
|
||||||
|
# Escape any HTML in the text
|
||||||
|
text = escape(text)
|
||||||
|
|
||||||
|
if linebreaks:
|
||||||
|
text = text.strip().replace("\n", "<br />\n")
|
||||||
|
super().__init__(text, style, *args, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
def register_ttf_font_if_new(name, path):
|
def register_ttf_font_if_new(name, path):
|
||||||
from reportlab.pdfbase import pdfmetrics
|
from reportlab.pdfbase import pdfmetrics
|
||||||
from reportlab.pdfbase.ttfonts import TTFont
|
from reportlab.pdfbase.ttfonts import TTFont
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ import time
|
|||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.contrib.auth import login as auth_login
|
from django.contrib.auth import login as auth_login
|
||||||
from django.contrib.gis.geoip2 import GeoIP2
|
from django.contrib.gis import geoip2
|
||||||
from django.core.cache import cache
|
from django.core.cache import cache
|
||||||
from django.utils.timezone import now
|
from django.utils.timezone import now
|
||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
@@ -63,14 +63,20 @@ def get_user_agent_hash(request):
|
|||||||
_geoip = None
|
_geoip = None
|
||||||
|
|
||||||
|
|
||||||
def _get_country(request):
|
def get_geoip() -> geoip2.GeoIP2:
|
||||||
|
# See https://code.djangoproject.com/ticket/36988#ticket
|
||||||
global _geoip
|
global _geoip
|
||||||
|
|
||||||
if not _geoip:
|
geoip2.SUPPORTED_DATABASE_TYPES.add("Geoacumen-Country")
|
||||||
_geoip = GeoIP2()
|
|
||||||
|
|
||||||
|
if not _geoip:
|
||||||
|
_geoip = geoip2.GeoIP2()
|
||||||
|
return _geoip
|
||||||
|
|
||||||
|
|
||||||
|
def _get_country(request):
|
||||||
try:
|
try:
|
||||||
res = _geoip.country(get_client_ip(request))
|
res = get_geoip().country(get_client_ip(request))
|
||||||
except AddressNotFoundError:
|
except AddressNotFoundError:
|
||||||
return None
|
return None
|
||||||
return res['country_code']
|
return res['country_code']
|
||||||
|
|||||||
@@ -0,0 +1,33 @@
|
|||||||
|
#
|
||||||
|
# This file is part of pretix (Community Edition).
|
||||||
|
#
|
||||||
|
# Copyright (C) 2014-2020 Raphael Michel and contributors
|
||||||
|
# Copyright (C) 2020-today pretix GmbH and contributors
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General
|
||||||
|
# Public License as published by the Free Software Foundation in version 3 of the License.
|
||||||
|
#
|
||||||
|
# ADDITIONAL TERMS APPLY: Pursuant to Section 7 of the GNU Affero General Public License, additional terms are
|
||||||
|
# applicable granting you additional permissions and placing additional restrictions on your usage of this software.
|
||||||
|
# Please refer to the pretix LICENSE file to obtain the full terms applicable to this work. If you did not receive
|
||||||
|
# this file, see <https://pretix.eu/about/en/license>.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
|
||||||
|
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||||
|
# details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Affero General Public License along with this program. If not, see
|
||||||
|
# <https://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
import logging
|
||||||
|
|
||||||
|
from django import template
|
||||||
|
from django.utils.html import format_html
|
||||||
|
|
||||||
|
register = template.Library()
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
@register.filter
|
||||||
|
def wrap_in(content, tag_name):
|
||||||
|
return format_html(f'<{tag_name}>{{}}</{tag_name}>', content)
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -32,6 +32,7 @@ ausgecheckt
|
|||||||
ausgeklappt
|
ausgeklappt
|
||||||
auswahl
|
auswahl
|
||||||
Authentication
|
Authentication
|
||||||
|
Authenticator
|
||||||
Authenticator-App
|
Authenticator-App
|
||||||
Autorisierungscode
|
Autorisierungscode
|
||||||
Autorisierungs-Endpunktes
|
Autorisierungs-Endpunktes
|
||||||
@@ -130,6 +131,7 @@ Eingangsscan
|
|||||||
Einlassbuchung
|
Einlassbuchung
|
||||||
Einlassdatum
|
Einlassdatum
|
||||||
Einlasskontrolle
|
Einlasskontrolle
|
||||||
|
Einmalpasswörter
|
||||||
einzuchecken
|
einzuchecken
|
||||||
email
|
email
|
||||||
E-Mail-Renderer
|
E-Mail-Renderer
|
||||||
@@ -163,6 +165,7 @@ Explorer
|
|||||||
FA
|
FA
|
||||||
Favicon
|
Favicon
|
||||||
F-Droid
|
F-Droid
|
||||||
|
freeOTP
|
||||||
Footer
|
Footer
|
||||||
Footer-Link
|
Footer-Link
|
||||||
Footer-Text
|
Footer-Text
|
||||||
@@ -557,6 +560,7 @@ Zahlungs-ID
|
|||||||
Zahlungspflichtig
|
Zahlungspflichtig
|
||||||
Zehnerkarten
|
Zehnerkarten
|
||||||
Zeitbasiert
|
Zeitbasiert
|
||||||
|
zeitbasierte
|
||||||
Zeitslotbuchung
|
Zeitslotbuchung
|
||||||
Zimpler
|
Zimpler
|
||||||
ZIP-Datei
|
ZIP-Datei
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -32,6 +32,7 @@ ausgecheckt
|
|||||||
ausgeklappt
|
ausgeklappt
|
||||||
auswahl
|
auswahl
|
||||||
Authentication
|
Authentication
|
||||||
|
Authenticator
|
||||||
Authenticator-App
|
Authenticator-App
|
||||||
Autorisierungscode
|
Autorisierungscode
|
||||||
Autorisierungs-Endpunktes
|
Autorisierungs-Endpunktes
|
||||||
@@ -130,6 +131,7 @@ Eingangsscan
|
|||||||
Einlassbuchung
|
Einlassbuchung
|
||||||
Einlassdatum
|
Einlassdatum
|
||||||
Einlasskontrolle
|
Einlasskontrolle
|
||||||
|
Einmalpasswörter
|
||||||
einzuchecken
|
einzuchecken
|
||||||
email
|
email
|
||||||
E-Mail-Renderer
|
E-Mail-Renderer
|
||||||
@@ -163,6 +165,7 @@ Explorer
|
|||||||
FA
|
FA
|
||||||
Favicon
|
Favicon
|
||||||
F-Droid
|
F-Droid
|
||||||
|
freeOTP
|
||||||
Footer
|
Footer
|
||||||
Footer-Link
|
Footer-Link
|
||||||
Footer-Text
|
Footer-Text
|
||||||
@@ -557,6 +560,7 @@ Zahlungs-ID
|
|||||||
Zahlungspflichtig
|
Zahlungspflichtig
|
||||||
Zehnerkarten
|
Zehnerkarten
|
||||||
Zeitbasiert
|
Zeitbasiert
|
||||||
|
zeitbasierte
|
||||||
Zeitslotbuchung
|
Zeitslotbuchung
|
||||||
Zimpler
|
Zimpler
|
||||||
ZIP-Datei
|
ZIP-Datei
|
||||||
|
|||||||
+310
-288
File diff suppressed because it is too large
Load Diff
@@ -8,7 +8,7 @@ msgid ""
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: PACKAGE VERSION\n"
|
"Project-Id-Version: PACKAGE VERSION\n"
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"POT-Creation-Date: 2026-03-17 14:06+0000\n"
|
"POT-Creation-Date: 2026-03-30 11:25+0000\n"
|
||||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -8,7 +8,7 @@ msgstr ""
|
|||||||
"Project-Id-Version: PACKAGE VERSION\n"
|
"Project-Id-Version: PACKAGE VERSION\n"
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"POT-Creation-Date: 2026-03-17 14:06+0000\n"
|
"POT-Creation-Date: 2026-03-17 14:06+0000\n"
|
||||||
"PO-Revision-Date: 2026-03-18 12:23+0000\n"
|
"PO-Revision-Date: 2026-03-30 03:00+0000\n"
|
||||||
"Last-Translator: CVZ-es <damien.bremont@casadevelazquez.org>\n"
|
"Last-Translator: CVZ-es <damien.bremont@casadevelazquez.org>\n"
|
||||||
"Language-Team: Spanish <https://translate.pretix.eu/projects/pretix/pretix-"
|
"Language-Team: Spanish <https://translate.pretix.eu/projects/pretix/pretix-"
|
||||||
"js/es/>\n"
|
"js/es/>\n"
|
||||||
@@ -329,7 +329,7 @@ msgstr "Pedido no aprobado"
|
|||||||
|
|
||||||
#: pretix/plugins/webcheckin/static/pretixplugins/webcheckin/main.js:68
|
#: pretix/plugins/webcheckin/static/pretixplugins/webcheckin/main.js:68
|
||||||
msgid "Checked-in Tickets"
|
msgid "Checked-in Tickets"
|
||||||
msgstr "Registro de código QR"
|
msgstr "Billetes registrados"
|
||||||
|
|
||||||
#: pretix/plugins/webcheckin/static/pretixplugins/webcheckin/main.js:69
|
#: pretix/plugins/webcheckin/static/pretixplugins/webcheckin/main.js:69
|
||||||
msgid "Valid Tickets"
|
msgid "Valid Tickets"
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -8,8 +8,8 @@ msgstr ""
|
|||||||
"Project-Id-Version: PACKAGE VERSION\n"
|
"Project-Id-Version: PACKAGE VERSION\n"
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"POT-Creation-Date: 2026-03-17 14:06+0000\n"
|
"POT-Creation-Date: 2026-03-17 14:06+0000\n"
|
||||||
"PO-Revision-Date: 2026-02-10 16:49+0000\n"
|
"PO-Revision-Date: 2026-03-25 14:14+0000\n"
|
||||||
"Last-Translator: Raffaele Doretto <ced@comune.portogruaro.ve.it>\n"
|
"Last-Translator: Pietro Isotti <isottipietro@gmail.com>\n"
|
||||||
"Language-Team: Italian <https://translate.pretix.eu/projects/pretix/pretix-"
|
"Language-Team: Italian <https://translate.pretix.eu/projects/pretix/pretix-"
|
||||||
"js/it/>\n"
|
"js/it/>\n"
|
||||||
"Language: it\n"
|
"Language: it\n"
|
||||||
@@ -17,7 +17,7 @@ msgstr ""
|
|||||||
"Content-Type: text/plain; charset=UTF-8\n"
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
"Content-Transfer-Encoding: 8bit\n"
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
||||||
"X-Generator: Weblate 5.15.2\n"
|
"X-Generator: Weblate 5.16.2\n"
|
||||||
|
|
||||||
#: pretix/plugins/banktransfer/static/pretixplugins/banktransfer/ui.js:56
|
#: pretix/plugins/banktransfer/static/pretixplugins/banktransfer/ui.js:56
|
||||||
#: pretix/plugins/banktransfer/static/pretixplugins/banktransfer/ui.js:62
|
#: pretix/plugins/banktransfer/static/pretixplugins/banktransfer/ui.js:62
|
||||||
@@ -310,9 +310,8 @@ msgid "Ticket code revoked/changed"
|
|||||||
msgstr "Codice biglietto annullato/modificato"
|
msgstr "Codice biglietto annullato/modificato"
|
||||||
|
|
||||||
#: pretix/plugins/webcheckin/static/pretixplugins/webcheckin/main.js:63
|
#: pretix/plugins/webcheckin/static/pretixplugins/webcheckin/main.js:63
|
||||||
#, fuzzy
|
|
||||||
msgid "Ticket blocked"
|
msgid "Ticket blocked"
|
||||||
msgstr "Biglietto non pagato"
|
msgstr "Biglietto bloccato"
|
||||||
|
|
||||||
#: pretix/plugins/webcheckin/static/pretixplugins/webcheckin/main.js:64
|
#: pretix/plugins/webcheckin/static/pretixplugins/webcheckin/main.js:64
|
||||||
msgid "Ticket not valid at this time"
|
msgid "Ticket not valid at this time"
|
||||||
@@ -429,7 +428,7 @@ msgstr ""
|
|||||||
|
|
||||||
#: pretix/static/pretixbase/js/asynctask.js:276
|
#: pretix/static/pretixbase/js/asynctask.js:276
|
||||||
msgid "If this takes longer than a few minutes, please contact us."
|
msgid "If this takes longer than a few minutes, please contact us."
|
||||||
msgstr ""
|
msgstr "Se questa operazione richiede alcuni minuti, si prega di contattarci."
|
||||||
|
|
||||||
#: pretix/static/pretixbase/js/asynctask.js:331
|
#: pretix/static/pretixbase/js/asynctask.js:331
|
||||||
msgid "Close message"
|
msgid "Close message"
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -8,7 +8,7 @@ msgstr ""
|
|||||||
"Project-Id-Version: PACKAGE VERSION\n"
|
"Project-Id-Version: PACKAGE VERSION\n"
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"POT-Creation-Date: 2026-03-17 14:06+0000\n"
|
"POT-Creation-Date: 2026-03-17 14:06+0000\n"
|
||||||
"PO-Revision-Date: 2026-02-23 10:00+0000\n"
|
"PO-Revision-Date: 2026-03-23 21:00+0000\n"
|
||||||
"Last-Translator: Hijiri Umemoto <hijiri@umemoto.org>\n"
|
"Last-Translator: Hijiri Umemoto <hijiri@umemoto.org>\n"
|
||||||
"Language-Team: Japanese <https://translate.pretix.eu/projects/pretix/pretix-"
|
"Language-Team: Japanese <https://translate.pretix.eu/projects/pretix/pretix-"
|
||||||
"js/ja/>\n"
|
"js/ja/>\n"
|
||||||
@@ -17,7 +17,7 @@ msgstr ""
|
|||||||
"Content-Type: text/plain; charset=UTF-8\n"
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
"Content-Transfer-Encoding: 8bit\n"
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
"Plural-Forms: nplurals=1; plural=0;\n"
|
"Plural-Forms: nplurals=1; plural=0;\n"
|
||||||
"X-Generator: Weblate 5.16\n"
|
"X-Generator: Weblate 5.16.2\n"
|
||||||
|
|
||||||
#: pretix/plugins/banktransfer/static/pretixplugins/banktransfer/ui.js:56
|
#: pretix/plugins/banktransfer/static/pretixplugins/banktransfer/ui.js:56
|
||||||
#: pretix/plugins/banktransfer/static/pretixplugins/banktransfer/ui.js:62
|
#: pretix/plugins/banktransfer/static/pretixplugins/banktransfer/ui.js:62
|
||||||
@@ -60,7 +60,7 @@ msgstr "PayPal後払い"
|
|||||||
|
|
||||||
#: pretix/plugins/paypal2/static/pretixplugins/paypal2/pretix-paypal.js:41
|
#: pretix/plugins/paypal2/static/pretixplugins/paypal2/pretix-paypal.js:41
|
||||||
msgid "iDEAL | Wero"
|
msgid "iDEAL | Wero"
|
||||||
msgstr ""
|
msgstr "iDEAL | Wero"
|
||||||
|
|
||||||
#: pretix/plugins/paypal2/static/pretixplugins/paypal2/pretix-paypal.js:42
|
#: pretix/plugins/paypal2/static/pretixplugins/paypal2/pretix-paypal.js:42
|
||||||
msgid "SEPA Direct Debit"
|
msgid "SEPA Direct Debit"
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user