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 :)
@@ -109,7 +109,10 @@ class ProjectDashboard(PrivateViewMixin, ListView):
notification.send()
def get_queryset(self):
- return Project.objects.dashboard(self.request.user)
+ 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)
def get(self, request, *args, **kwargs):
self.validate_primary_email(request.user)
