From 4ace181d364b10a496059464ee15073b07e7b5fd Mon Sep 17 00:00:00 2001 From: Ernesto Rico Schmidt <ernesto@helsinki.at> Date: Mon, 4 Nov 2024 12:35:17 -0400 Subject: [PATCH] feat: simplify get_queryset --- program/views.py | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/program/views.py b/program/views.py index 870da0c9..a47d00ce 100644 --- a/program/views.py +++ b/program/views.py @@ -1638,20 +1638,12 @@ class APIPlaylistViewSet(viewsets.ModelViewSet): serializer_class = PlaylistSerializer def get_queryset(self): - """The queryset is empty if the request is not authenticated, it contains all the playlists - if the request method is safe or if the requesting user has the `create_playlist` or the - `update_playlist`, otherwise it only contains playlists for shows owned by the - requesting user.""" + """The queryset is empty if the request is not authenticated. Otherwise, it contains all + the playlists.""" user = self.request.user if not user.is_authenticated: return Playlist.objects.none() - elif ( - self.request.method in permissions.SAFE_METHODS - or user.has_perm("program.create_playlist") - or user.has_perm("program.update_playlist") - ): - return Playlist.objects.all() - else: - return Playlist.objects.filter(show__owners=user) + + return Playlist.objects.all() -- GitLab