Skip to content

Commit 8e09571

Browse files
committed
Add ability to sort dashboard by modified date
This only implemented the backend, so you can pass a GET arg to it to have it sort. The goal will be to have a proper UI for this after the UI refactor, but I want this now :)
1 parent c5ac7f7 commit 8e09571

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

readthedocs/projects/views/private.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,10 @@ def validate_primary_email(self, user):
109109
notification.send()
110110

111111
def get_queryset(self):
112-
return Project.objects.dashboard(self.request.user)
112+
sort = self.request.GET.get('sort')
113+
if sort not in ['modified_date', '-modified_date', 'slug', '-slug']:
114+
sort = 'slug'
115+
return Project.objects.dashboard(self.request.user).order_by(sort)
113116

114117
def get(self, request, *args, **kwargs):
115118
self.validate_primary_email(request.user)

0 commit comments

Comments
 (0)