mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-30 13:31:08 +00:00
Only call .all once in shelf view
This commit is contained in:
parent
cb089ed817
commit
8e8f46ee51
1 changed files with 4 additions and 4 deletions
|
@ -31,9 +31,9 @@ class Shelf(View):
|
|||
is_self = user == request.user
|
||||
|
||||
if is_self:
|
||||
shelves = user.shelf_set
|
||||
shelves = user.shelf_set.all()
|
||||
else:
|
||||
shelves = privacy_filter(request.user, user.shelf_set)
|
||||
shelves = privacy_filter(request.user, user.shelf_set).all()
|
||||
|
||||
# get the shelf and make sure the logged in user should be able to see it
|
||||
if shelf_identifier:
|
||||
|
@ -53,7 +53,7 @@ class Shelf(View):
|
|||
models.Edition.viewer_aware_objects(request.user)
|
||||
.filter(
|
||||
# privacy is ensured because the shelves are already filtered above
|
||||
shelfbook__shelf__in=shelves.all()
|
||||
shelfbook__shelf__in=shelves
|
||||
)
|
||||
.distinct()
|
||||
)
|
||||
|
@ -86,7 +86,7 @@ class Shelf(View):
|
|||
data = {
|
||||
"user": user,
|
||||
"is_self": is_self,
|
||||
"shelves": shelves.all(),
|
||||
"shelves": shelves,
|
||||
"shelf": shelf,
|
||||
"books": page,
|
||||
"page_range": paginated.get_elided_page_range(
|
||||
|
|
Loading…
Reference in a new issue