Features: 1) None;

Fixes: 1) Correct handling of the Select2 i18n file path in admin media to prevent issues with optional language files;

Extra: 1) Minor refactoring to streamline JavaScript file list construction.
This commit is contained in:
Egor Pavlovich Gorbunov 2025-07-01 12:54:50 +03:00
parent a98b81d284
commit 1edec85c3a

View file

@ -275,7 +275,6 @@ class ProductAdmin(FieldsetsMixin, BasicModelAdmin):
@property
def media(self):
i18n_name = get_select2_language()
i18n_file = (f"vendor/select2/i18n/{i18n_name}.js",) if i18n_name else ()
extra = "" if settings.DEBUG else ".min"
js = [
f"vendor/jquery/jquery{extra}.js",
@ -288,7 +287,7 @@ class ProductAdmin(FieldsetsMixin, BasicModelAdmin):
f"vendor/xregexp/xregexp{extra}.js",
"vendor/jquery/jquery.min.js",
"vendor/select2/select2.full.min.js",
*i18n_file,
f"vendor/select2/i18n/{i18n_name}.js" if i18n_name else (),
"jquery.init.js",
"django_admin_list_filter.js",
]