Features: 1) Add get_queryset method to filter Wishlists by user permission;

Fixes: 1) None;

Extra: Update evibes-big-simple.png in documentation;
This commit is contained in:
Egor Pavlovich Gorbunov 2025-05-29 23:13:21 +03:00
parent ac3268748e
commit 543594c2b8
2 changed files with 9 additions and 0 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 61 KiB

After

Width:  |  Height:  |  Size: 62 KiB

View file

@ -428,6 +428,15 @@ class WishlistViewSet(EvibesViewSet):
"list": WishlistSimpleSerializer, "list": WishlistSimpleSerializer,
} }
def get_queryset(self):
qs = super().get_queryset()
user = self.request.user
if user.has_perm("core.view_wishlist"):
return qs
return qs.filter(user=user)
@action(detail=False, methods=["get"], url_path="current") @action(detail=False, methods=["get"], url_path="current")
def current(self, request, *_args, **kwargs): def current(self, request, *_args, **kwargs):
if not request.user.is_authenticated: if not request.user.is_authenticated: