upstream/v2026.1.0 #12

Merged
simon merged 241 commits from upstream/v2026.1.0 into master 2026-02-03 21:56:32 +00:00
3 changed files with 17 additions and 7 deletions
Showing only changes of commit 59c09e27fd - Show all commits

View File

@@ -51,7 +51,7 @@ dependencies = [
"django-markup",
"django-oauth-toolkit==2.3.*",
"django-otp==1.6.*",
"django-phonenumber-field==7.3.*",
"django-phonenumber-field==8.3.*",
"django-redis==6.0.*",
"django-scopes==2.0.*",
"django-statici18n==2.6.*",

View File

@@ -66,8 +66,10 @@ from geoip2.errors import AddressNotFoundError
from phonenumber_field.formfields import PhoneNumberField
from phonenumber_field.phonenumber import PhoneNumber
from phonenumber_field.widgets import PhoneNumberPrefixWidget
from phonenumbers import NumberParseException, national_significant_number
from phonenumbers.data import _COUNTRY_CODE_TO_REGION_CODE
from phonenumbers import (
COUNTRY_CODE_TO_REGION_CODE, REGION_CODE_FOR_NON_GEO_ENTITY,
NumberParseException, national_significant_number,
)
from PIL import ImageOps
from pretix.base.forms.widgets import (
@@ -305,7 +307,9 @@ class WrappedPhonePrefixSelect(Select):
choices = [("", "---------")]
if initial:
for prefix, values in _COUNTRY_CODE_TO_REGION_CODE.items():
for prefix, values in COUNTRY_CODE_TO_REGION_CODE.items():
if all(v == REGION_CODE_FOR_NON_GEO_ENTITY for v in values):
continue
if initial in values:
self.initial = "+%d" % prefix
break
@@ -437,7 +441,9 @@ def guess_phone_prefix_from_request(request, event):
def get_phone_prefix(country):
for prefix, values in _COUNTRY_CODE_TO_REGION_CODE.items():
if country == REGION_CODE_FOR_NON_GEO_ENTITY:
return None
for prefix, values in COUNTRY_CODE_TO_REGION_CODE.items():
if country in values:
return prefix
return None

View File

@@ -25,7 +25,9 @@ from django.utils import translation
from django.utils.translation import gettext_noop
from django_countries import Countries, collator
from django_countries.fields import CountryField
from phonenumbers.data import _COUNTRY_CODE_TO_REGION_CODE
from phonenumbers import (
COUNTRY_CODE_TO_REGION_CODE, REGION_CODE_FOR_NON_GEO_ENTITY,
)
from pretix.base.i18n import get_babel_locale, get_language_without_region
@@ -109,9 +111,11 @@ def get_phone_prefixes_sorted_and_localized():
val = []
locale = Locale(translation.to_locale(language))
for prefix, values in _COUNTRY_CODE_TO_REGION_CODE.items():
for prefix, values in COUNTRY_CODE_TO_REGION_CODE.items():
prefix = "+%d" % prefix
for country_code in values:
if country_code == REGION_CODE_FOR_NON_GEO_ENTITY:
continue
country_name = locale.territories.get(country_code)
if country_name:
val.append((prefix, "{} {}".format(country_name, prefix)))