diff --git a/core/serializers/detail.py b/core/serializers/detail.py index 1869140b..217a29fa 100644 --- a/core/serializers/detail.py +++ b/core/serializers/detail.py @@ -1,7 +1,5 @@ import logging -from collections.abc import Collection from contextlib import suppress -from typing import Any from django.contrib.auth.models import AnonymousUser from django.core.cache import cache @@ -115,21 +113,14 @@ class CategoryDetailSerializer(ModelSerializer): return filterable_results - def get_children(self, obj) -> Collection[Any]: + def get_children(self, obj) -> list: request = self.context.get("request") if request is not None and request.user.has_perm("view_category"): children = obj.children.all() else: children = obj.children.filter(is_active=True) - if obj.children.exists(): - return ( - CategoryDetailSerializer(children, many=True, context=self.context).data - if obj.children.exists() - else [] - ) - else: - return [] + return CategoryDetailSerializer(children, many=True, context=self.context).data if obj.children.exists() else [] class BrandDetailSerializer(ModelSerializer): diff --git a/core/serializers/simple.py b/core/serializers/simple.py index f05e1a75..6f9e01ce 100644 --- a/core/serializers/simple.py +++ b/core/serializers/simple.py @@ -1,4 +1,3 @@ -from collections.abc import Collection from contextlib import suppress from rest_framework.fields import JSONField, SerializerMethodField @@ -59,21 +58,14 @@ class CategorySimpleSerializer(ModelSerializer): return obj.image.url return None - def get_children(self, obj) -> Collection: + def get_children(self, obj) -> list: request = self.context.get("request") if request is not None and request.user.has_perm("view_category"): children = obj.children.all() else: children = obj.children.filter(is_active=True) - if obj.children.exists(): - return ( - CategorySimpleSerializer(children, many=True, context=self.context).data - if obj.children.exists() - else [] - ) - else: - return [] + return CategorySimpleSerializer(children, many=True, context=self.context).data if obj.children.exists() else [] class BrandSimpleSerializer(ModelSerializer): diff --git a/payments/serializers.py b/payments/serializers.py index 47f953a0..c3191e8f 100644 --- a/payments/serializers.py +++ b/payments/serializers.py @@ -19,11 +19,11 @@ class TransactionProcessSerializer(ModelSerializer): order_hr_id = SerializerMethodField(read_only=True, required=False) order_uuid = SerializerMethodField(read_only=True, required=False) - def get_order_hr_id(self, obj: Transaction): + def get_order_hr_id(self, obj: Transaction) -> str | None: return obj.order.human_readable_id if obj.order else None # type: ignore - def get_order_uuid(self, obj: Transaction): - return obj.order.uuid if obj.order else None # type: ignore + def get_order_uuid(self, obj: Transaction) -> str | None: + return str(obj.order.uuid) if obj.order else None # type: ignore class Meta: model = Transaction diff --git a/vibes_auth/locale/ru_RU/LC_MESSAGES/django.mo b/vibes_auth/locale/ru_RU/LC_MESSAGES/django.mo index fb02b957..be0f617f 100644 Binary files a/vibes_auth/locale/ru_RU/LC_MESSAGES/django.mo and b/vibes_auth/locale/ru_RU/LC_MESSAGES/django.mo differ diff --git a/vibes_auth/locale/ru_RU/LC_MESSAGES/django.po b/vibes_auth/locale/ru_RU/LC_MESSAGES/django.po index 31fa2c4e..04c9b86e 100644 --- a/vibes_auth/locale/ru_RU/LC_MESSAGES/django.po +++ b/vibes_auth/locale/ru_RU/LC_MESSAGES/django.po @@ -282,7 +282,7 @@ msgstr "Токен в черном списке" #: vibes_auth/models.py:131 msgid "blacklisted tokens" -msgstr "Токены, внесенные в черный список" +msgstr "Чёрный список токенов" #: vibes_auth/serializers.py:110 vibes_auth/serializers.py:132 msgid "no active account"