fix: filtering capabilities, feat: improve enum i18n

This commit is contained in:
Alexander Kalinovsky
2025-01-31 00:10:45 +01:00
parent f666bcfba3
commit a22ab9b0de
8 changed files with 41 additions and 14 deletions

View File

@@ -1,3 +1,4 @@
from aiogram.utils.i18n import I18n
from pydantic_core.core_schema import str_schema
from sqlalchemy.types import TypeDecorator, String
from typing import Any, Self, overload
@@ -133,7 +134,11 @@ class EnumMember(object):
if lang and lang in self.loc_obj.keys():
return self.loc_obj[lang]
else:
return self.loc_obj[list(self.loc_obj.keys())[0]]
i18n = I18n.get_current()
if i18n:
return self.loc_obj[i18n.current_locale]
else:
return self.loc_obj[list(self.loc_obj.keys())[0]]
return self.value

View File

@@ -64,7 +64,7 @@ class EntityList:
show_add_new_button: bool = True
item_form: str | None = None
pagination: bool = True
static_filters: list[Filter] | Any = None
static_filters: list[Filter] = None
filtering: bool = False
filtering_fields: list[str] = None
order_by: str | Any | None = None