Resolves ambiguous ordering in views

This commit is contained in:
Mouse Reeve 2021-08-02 17:48:29 -07:00
parent 338dfd4909
commit 4dddd67d0c
2 changed files with 7 additions and 3 deletions

View file

@ -51,7 +51,7 @@ class Announcements(View):
form = forms.AnnouncementForm() form = forms.AnnouncementForm()
data = { data = {
"announcements": Paginator( "announcements": Paginator(
models.Announcement.objects.all(), PAGE_LENGTH models.Announcement.objects.order_by("-created_date"), PAGE_LENGTH
).get_page(request.GET.get("page")), ).get_page(request.GET.get("page")),
"form": form, "form": form,
} }

View file

@ -88,7 +88,9 @@ class Followers(View):
if is_api_request(request): if is_api_request(request):
return ActivitypubResponse(user.to_followers_activity(**request.GET)) 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 = { data = {
"user": user, "user": user,
"is_self": request.user.id == user.id, "is_self": request.user.id == user.id,
@ -107,7 +109,9 @@ class Following(View):
if is_api_request(request): if is_api_request(request):
return ActivitypubResponse(user.to_following_activity(**request.GET)) 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 = { data = {
"user": user, "user": user,
"is_self": request.user.id == user.id, "is_self": request.user.id == user.id,