Was added to searching support languages other than English for object types(s).

This commit is contained in:
Julio-Oliveira-Encora 2024-06-24 14:03:25 -03:00
parent 00d9a865c0
commit 2388354936

View File

@ -8,6 +8,7 @@ from django.db.models.fields.related import ForeignKey
from django.db.models.functions import window from django.db.models.functions import window
from django.db.models.signals import post_delete, post_save from django.db.models.signals import post_delete, post_save
from django.utils.module_loading import import_string from django.utils.module_loading import import_string
from django.utils.translation import gettext_lazy as _
import netaddr import netaddr
from netaddr.core import AddrFormatError from netaddr.core import AddrFormatError
@ -39,7 +40,7 @@ class SearchBackend:
# Organize choices by category # Organize choices by category
categories = defaultdict(dict) categories = defaultdict(dict)
for label, idx in registry['search'].items(): for label, idx in registry['search'].items():
categories[idx.get_category()][label] = title(idx.model._meta.verbose_name) categories[idx.get_category()][label] = _(title(idx.model._meta.verbose_name))
# Compile a nested tuple of choices for form rendering # Compile a nested tuple of choices for form rendering
results = ( results = (