mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-27 03:51:08 +00:00
Merge pull request #1241 from bookwyrm-social/ambiguous-ordering
Resolves ambiguous ordering in views
This commit is contained in:
commit
af8851fc2e
2 changed files with 7 additions and 3 deletions
|
@ -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,
|
||||||
}
|
}
|
||||||
|
|
|
@ -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,
|
||||||
|
|
Loading…
Reference in a new issue