From 4dddd67d0c514819226adadded639225459c8e42 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Mon, 2 Aug 2021 17:48:29 -0700 Subject: [PATCH] Resolves ambiguous ordering in views --- bookwyrm/views/announcements.py | 2 +- bookwyrm/views/user.py | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/bookwyrm/views/announcements.py b/bookwyrm/views/announcements.py index e522fc7f..05386b7b 100644 --- a/bookwyrm/views/announcements.py +++ b/bookwyrm/views/announcements.py @@ -51,7 +51,7 @@ class Announcements(View): form = forms.AnnouncementForm() data = { "announcements": Paginator( - models.Announcement.objects.all(), PAGE_LENGTH + models.Announcement.objects.order_by("-created_date"), PAGE_LENGTH ).get_page(request.GET.get("page")), "form": form, } diff --git a/bookwyrm/views/user.py b/bookwyrm/views/user.py index f62913a9..87e42b4e 100644 --- a/bookwyrm/views/user.py +++ b/bookwyrm/views/user.py @@ -88,7 +88,9 @@ class Followers(View): if is_api_request(request): return ActivitypubResponse(user.to_followers_activity(**request.GET)) - paginated = Paginator(user.followers.all(), PAGE_LENGTH) + paginated = Paginator( + user.followers.order_by("-created_date").all(), PAGE_LENGTH + ) data = { "user": user, "is_self": request.user.id == user.id, @@ -107,7 +109,9 @@ class Following(View): if is_api_request(request): return ActivitypubResponse(user.to_following_activity(**request.GET)) - paginated = Paginator(user.following.all(), PAGE_LENGTH) + paginated = Paginator( + user.following.order_by("-created_date").all(), PAGE_LENGTH + ) data = { "user": user, "is_self": request.user.id == user.id,