diff --git a/apps/podcast/views_admin.py b/apps/podcast/views_admin.py index 3f9be84..cdc900c 100644 --- a/apps/podcast/views_admin.py +++ b/apps/podcast/views_admin.py @@ -77,6 +77,10 @@ class AdminPodcastViewSet(ModelViewSet): if collection_id and collection_id != "all": queryset = queryset.filter(collections__id=collection_id) + unattached = self.request.query_params.get("unattached") + if unattached == "true": + queryset = queryset.filter(playlist_appearances__isnull=True) + return queryset.distinct().order_by("-created_at") diff --git a/apps/video/views_admin.py b/apps/video/views_admin.py index c1c7ab7..9f46e35 100644 --- a/apps/video/views_admin.py +++ b/apps/video/views_admin.py @@ -74,6 +74,10 @@ class AdminVideoViewSet(ModelViewSet): if video_type and video_type != "all": queryset = queryset.filter(video_type=video_type) + unattached = self.request.query_params.get("unattached") + if unattached == "true": + queryset = queryset.filter(playlist_appearances__isnull=True) + return queryset.order_by("-created_at")