Merge pull request #1241 from bookwyrm-social/ambiguous-ordering

Resolves ambiguous ordering in views
This commit is contained in:
Mouse Reeve 2021-08-02 19:02:46 -06:00 committed by GitHub
commit af8851fc2e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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,