Remove superfluous calls to all()
This commit is contained in:
@ -174,7 +174,7 @@ def get_suggested_books(user, max_books=5):
|
||||
)
|
||||
shelf = user.shelf_set.get(identifier=preset)
|
||||
|
||||
shelf_books = shelf.shelfbook_set.order_by("-updated_date").all()[:limit]
|
||||
shelf_books = shelf.shelfbook_set.order_by("-updated_date")[:limit]
|
||||
if not shelf_books:
|
||||
continue
|
||||
shelf_preview = {
|
||||
|
@ -75,7 +75,7 @@ class UserLists(View):
|
||||
except ValueError:
|
||||
page = 1
|
||||
user = get_user_from_username(request.user, username)
|
||||
lists = models.List.objects.filter(user=user).all()
|
||||
lists = models.List.objects.filter(user=user)
|
||||
lists = privacy_filter(request.user, lists)
|
||||
paginated = Paginator(lists, 12)
|
||||
|
||||
|
@ -61,7 +61,7 @@ class Shelf(View):
|
||||
return ActivitypubResponse(shelf.to_activity(**request.GET))
|
||||
|
||||
paginated = Paginator(
|
||||
shelf.books.order_by("-updated_date").all(),
|
||||
shelf.books.order_by("-updated_date"),
|
||||
PAGE_LENGTH,
|
||||
)
|
||||
|
||||
|
@ -64,7 +64,7 @@ class User(View):
|
||||
{
|
||||
"name": user_shelf.name,
|
||||
"local_path": user_shelf.local_path,
|
||||
"books": user_shelf.books.all()[:3],
|
||||
"books": user_shelf.books[:3],
|
||||
"size": user_shelf.books.count(),
|
||||
}
|
||||
)
|
||||
|
Reference in New Issue
Block a user