mirror of
https://github.com/django/django.git
synced 2024-12-22 17:16:24 +00:00
Fixed #33888 -- Fixed get_select2_language() crash with no language activated.
Regression in 3079133c73
.
This commit is contained in:
parent
a2792d09ad
commit
0638b4e23d
@ -456,7 +456,7 @@ SELECT2_TRANSLATIONS.update({"zh-hans": "zh-CN", "zh-hant": "zh-TW"})
|
|||||||
def get_select2_language():
|
def get_select2_language():
|
||||||
lang_code = get_language()
|
lang_code = get_language()
|
||||||
supported_code = SELECT2_TRANSLATIONS.get(lang_code)
|
supported_code = SELECT2_TRANSLATIONS.get(lang_code)
|
||||||
if supported_code is None:
|
if supported_code is None and lang_code is not None:
|
||||||
# If 'zh-hant-tw' is not supported, try subsequent language codes i.e.
|
# If 'zh-hant-tw' is not supported, try subsequent language codes i.e.
|
||||||
# 'zh-hant' and 'zh'.
|
# 'zh-hant' and 'zh'.
|
||||||
i = None
|
i = None
|
||||||
|
@ -11,3 +11,6 @@ Bugfixes
|
|||||||
|
|
||||||
* Reallowed, following a regression in Django 4.1, using ``GeoIP2()`` when GEOS
|
* Reallowed, following a regression in Django 4.1, using ``GeoIP2()`` when GEOS
|
||||||
is not installed (:ticket:`33886`).
|
is not installed (:ticket:`33886`).
|
||||||
|
|
||||||
|
* Fixed a regression in Django 4.1 that caused a crash of admin's autocomplete
|
||||||
|
widgets when translations are deactivated (:ticket:`33888`).
|
||||||
|
@ -179,6 +179,7 @@ class AutocompleteMixinTests(TestCase):
|
|||||||
("sr-cyrl", "sr-Cyrl"),
|
("sr-cyrl", "sr-Cyrl"),
|
||||||
("zh-hans", "zh-CN"),
|
("zh-hans", "zh-CN"),
|
||||||
("zh-hant", "zh-TW"),
|
("zh-hant", "zh-TW"),
|
||||||
|
(None, None),
|
||||||
)
|
)
|
||||||
for lang, select_lang in languages:
|
for lang, select_lang in languages:
|
||||||
with self.subTest(lang=lang):
|
with self.subTest(lang=lang):
|
||||||
|
Loading…
Reference in New Issue
Block a user