902 using get_page for Paginator instead of page

This commit is contained in:
Pablo Barton 2021-04-14 21:57:34 -04:00
parent 1e96191414
commit 88d37736ee
10 changed files with 14 additions and 14 deletions

View file

@ -524,7 +524,7 @@ def to_ordered_collection_page(
""" serialize and pagiante a queryset """
paginated = Paginator(queryset, PAGE_LENGTH)
activity_page = paginated.page(page)
activity_page = paginated.get_page(page)
if id_only:
items = [s.remote_id for s in activity_page.object_list]
else:

View file

@ -60,7 +60,7 @@ class Book(View):
paginated = Paginator(
reviews.exclude(Q(content__isnull=True) | Q(content="")), PAGE_LENGTH
)
reviews_page = paginated.page(page)
reviews_page = paginated.get_page(page)
user_tags = readthroughs = user_shelves = other_edition_shelves = []
if request.user.is_authenticated:
@ -285,7 +285,7 @@ class Editions(View):
paginated = Paginator(editions.filter(**filters).all(), PAGE_LENGTH)
data = {
"editions": paginated.page(page),
"editions": paginated.get_page(page),
"work": work,
"languages": languages,
"formats": set(

View file

@ -39,7 +39,7 @@ class Directory(View):
paginated = Paginator(users, 12)
data = {
"users": paginated.page(page),
"users": paginated.get_page(page),
}
return TemplateResponse(request, "directory/directory.html", data)

View file

@ -40,7 +40,7 @@ class Federation(View):
paginated = Paginator(servers, PAGE_LENGTH)
data = {
"servers": paginated.page(page),
"servers": paginated.get_page(page),
"sort": sort,
"form": forms.ServerForm(),
}

View file

@ -39,7 +39,7 @@ class Feed(View):
**feed_page_data(request.user),
**{
"user": request.user,
"activities": paginated.page(page),
"activities": paginated.get_page(page),
"suggested_users": suggested_users,
"tab": tab,
"goal_form": forms.GoalForm(),
@ -82,7 +82,7 @@ class DirectMessage(View):
).order_by("-published_date")
paginated = Paginator(activities, PAGE_LENGTH)
activity_page = paginated.page(page)
activity_page = paginated.get_page(page)
data = {
**feed_page_data(request.user),
**{

View file

@ -43,7 +43,7 @@ class ManageInvites(View):
)
data = {
"invites": paginated.page(page),
"invites": paginated.get_page(page),
"form": forms.CreateInviteForm(),
}
return TemplateResponse(request, "settings/manage_invites.html", data)
@ -136,7 +136,7 @@ class ManageInviteRequests(View):
data = {
"ignored": ignored,
"count": paginated.count,
"requests": paginated.page(page),
"requests": paginated.get_page(page),
"sort": sort,
}
return TemplateResponse(request, "settings/manage_invite_requests.html", data)

View file

@ -44,7 +44,7 @@ class Lists(View):
paginated = Paginator(lists, 12)
data = {
"lists": paginated.page(page),
"lists": paginated.get_page(page),
"list_form": forms.ListForm(),
"path": "/list",
}
@ -79,7 +79,7 @@ class UserLists(View):
data = {
"user": user,
"is_self": request.user.id == user.id,
"lists": paginated.page(page),
"lists": paginated.get_page(page),
"list_form": forms.ListForm(),
"path": user.local_path + "/lists",
}

View file

@ -70,7 +70,7 @@ class Shelf(View):
"is_self": is_self,
"shelves": shelves.all(),
"shelf": shelf,
"books": paginated.page(page),
"books": paginated.get_page(page),
}
return TemplateResponse(request, "user/shelf.html", data)

View file

@ -87,7 +87,7 @@ class User(View):
"is_self": is_self,
"shelves": shelf_preview,
"shelf_count": shelves.count(),
"activities": paginated.page(page),
"activities": paginated.get_page(page),
"goal": goal,
}

View file

@ -46,5 +46,5 @@ class UserAdmin(View):
users = users.order_by(sort)
paginated = Paginator(users, PAGE_LENGTH)
data = {"users": paginated.page(page), "sort": sort, "server": server}
data = {"users": paginated.get_page(page), "sort": sort, "server": server}
return TemplateResponse(request, "settings/user_admin.html", data)