Skip to content

Commit

Permalink
Author filtering/pagination on default endpoint (#1749)
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesbiggs authored Nov 25, 2024
1 parent 6ba2cf8 commit 3373910
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion etna/api/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@


class CustomPagesAPIViewSet(PagesAPIViewSet):
known_query_parameters = PagesAPIViewSet.known_query_parameters.union(["password"])
known_query_parameters = PagesAPIViewSet.known_query_parameters.union(
["password", "author"]
)

def listing_view(self, request):
queryset = self.get_queryset()
Expand All @@ -45,6 +47,9 @@ def listing_view(self, request):
for restricted_page in restricted_pages:
queryset = queryset.not_descendant_of(restricted_page, inclusive=True)

if "author" in request.GET:
queryset = queryset.filter(author_tags__author=request.GET["author"])

self.check_query_parameters(queryset)
queryset = self.filter_queryset(queryset)
queryset = self.paginate_queryset(queryset)
Expand Down

0 comments on commit 3373910

Please sign in to comment.