Skip to content

Commit

Permalink
Only use django-filters filtering on project dashboard (#11622)
Browse files Browse the repository at this point in the history
  • Loading branch information
agjohnson authored Sep 26, 2024
1 parent f8cbc13 commit 794b58b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion readthedocs/projects/views/private.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,15 @@ def validate_primary_email(self, user):
)

def get_queryset(self):
queryset = Project.objects.dashboard(self.request.user)
if settings.RTD_EXT_THEME_ENABLED:
return queryset
# The new dashboard uses django-filters, this is a manual filter for the
# old dashboard and it can be removed with the old dashboard.
sort = self.request.GET.get("sort")
if sort not in ["modified_date", "-modified_date", "slug", "-slug"]:
sort = "slug"
return Project.objects.dashboard(self.request.user).order_by(sort)
return queryset.order_by(sort)

def get(self, request, *args, **kwargs):
self.validate_primary_email(request.user)
Expand Down

0 comments on commit 794b58b

Please sign in to comment.