|
|
@ -290,6 +290,16 @@ class HadisListView(ListAPIView): |
|
|
source_slugs = [s.strip() for s in source_filter.split(',')] |
|
|
source_slugs = [s.strip() for s in source_filter.split(',')] |
|
|
queryset = queryset.filter(references__book_reference__slug__in=source_slugs) |
|
|
queryset = queryset.filter(references__book_reference__slug__in=source_slugs) |
|
|
|
|
|
|
|
|
|
|
|
# 👇 5. Apply Source Author Filter (Supports author or source_author, multiple comma-separated slugs/IDs) |
|
|
|
|
|
author_filter = self.request.query_params.get('author', None) or self.request.query_params.get('source_author', None) |
|
|
|
|
|
if author_filter: |
|
|
|
|
|
author_slugs = [a.strip() for a in author_filter.split(',') if a.strip()] |
|
|
|
|
|
author_q = Q(references__book_reference__author__slug__in=author_slugs) |
|
|
|
|
|
numeric_ids = [int(a) for a in author_slugs if a.isdigit()] |
|
|
|
|
|
if numeric_ids: |
|
|
|
|
|
author_q |= Q(references__book_reference__author_id__in=numeric_ids) |
|
|
|
|
|
queryset = queryset.filter(author_q) |
|
|
|
|
|
|
|
|
# Filter by bookmarks if provided |
|
|
# Filter by bookmarks if provided |
|
|
is_bookmark = self.request.query_params.get('is_bookmark', '').lower() |
|
|
is_bookmark = self.request.query_params.get('is_bookmark', '').lower() |
|
|
if is_bookmark == 'true' and self.request.user.is_authenticated: |
|
|
if is_bookmark == 'true' and self.request.user.is_authenticated: |
|
|
|