Skip to content
Snippets Groups Projects
Verified Commit 3cdb0aee authored by Ernesto Rico Schmidt's avatar Ernesto Rico Schmidt
Browse files

feat: use PlaylistFilter instead of filtering the list

parent ff741fb2
No related branches found
No related tags found
1 merge request!59Add playlists
......@@ -1644,6 +1644,7 @@ class APIApplicationStateView(TestOperationViewMixin, views.APIView):
list=extend_schema(summary="List all playlists."),
)
class APIPlaylistViewSet(viewsets.ModelViewSet):
filterset_class = filters.PlaylistFilter
serializer_class = PlaylistSerializer
def get_queryset(self):
......@@ -1655,16 +1656,6 @@ class APIPlaylistViewSet(viewsets.ModelViewSet):
return Playlist.objects.all()
def list(self, request, *args, **kwargs):
if show_id := request.query_params.get("show_id"):
queryset = self.get_queryset().filter(show_id=int(show_id))
else:
queryset = self.get_queryset()
serializer = PlaylistSerializer(queryset, many=True)
return Response(serializer.data)
def create(self, request, *args, **kwargs):
serializer = PlaylistSerializer(
context={"request": request},
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment