From d767e17f2905264198f4a9df3a732f478c352adb Mon Sep 17 00:00:00 2001 From: Egor fureunoir Gorbunov Date: Mon, 18 Aug 2025 14:57:25 +0300 Subject: [PATCH] Features: 1) Add "seo" action with "view" permission mapping in `EvibesPermission`; 2) Extend action serializer classes with additional "seo" allowance in multiple viewsets. Fixes: 1) None. Extra: 1) Minor adjustments in viewsets for consistency in handling "seo" action. --- core/permissions.py | 1 + core/viewsets.py | 3 +++ 2 files changed, 4 insertions(+) diff --git a/core/permissions.py b/core/permissions.py index a462229b..69230b3d 100644 --- a/core/permissions.py +++ b/core/permissions.py @@ -17,6 +17,7 @@ class IsOwnerOrReadOnly(permissions.BasePermission): class EvibesPermission(permissions.BasePermission): ACTION_PERM_MAP = { "retrieve": "view", + "seo": "view", "list": "view", "create": "add", "update": "change", diff --git a/core/viewsets.py b/core/viewsets.py index 7f960292..ffef153a 100644 --- a/core/viewsets.py +++ b/core/viewsets.py @@ -283,6 +283,7 @@ class CategoryViewSet(EvibesViewSet): action_serializer_classes = { "list": CategorySimpleSerializer, } + additional = {"seo": "ALLOW"} def get_queryset(self): qs = super().get_queryset() @@ -378,6 +379,7 @@ class BrandViewSet(EvibesViewSet): action_serializer_classes = { "list": BrandSimpleSerializer, } + additional = {"seo": "ALLOW"} def get_queryset(self): queryset = Brand.objects.all() @@ -477,6 +479,7 @@ class ProductViewSet(EvibesViewSet): } lookup_field = "lookup_value" lookup_url_kwarg = "lookup_value" + additional = {"seo": "ALLOW"} def get_queryset(self): qs = super().get_queryset()