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:
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 |
|
|
@ -428,6 +428,15 @@ class WishlistViewSet(EvibesViewSet):
|
|||
"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")
|
||||
def current(self, request, *_args, **kwargs):
|
||||
if not request.user.is_authenticated:
|
||||
|
|
|
|||
Loading…
Reference in a new issue