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 """ """ serialize and pagiante a queryset """
paginated = Paginator(queryset, PAGE_LENGTH) paginated = Paginator(queryset, PAGE_LENGTH)
activity_page = paginated.page(page) activity_page = paginated.get_page(page)
if id_only: if id_only:
items = [s.remote_id for s in activity_page.object_list] items = [s.remote_id for s in activity_page.object_list]
else: else:

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -46,5 +46,5 @@ class UserAdmin(View):
users = users.order_by(sort) users = users.order_by(sort)
paginated = Paginator(users, PAGE_LENGTH) 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) return TemplateResponse(request, "settings/user_admin.html", data)