User viewer aware objects for book page
Plus other refactors for that view
This commit is contained in:
parent
6d06edc2c7
commit
995e2c47db
2 changed files with 30 additions and 18 deletions
|
@ -49,10 +49,14 @@ class Shelf(View):
|
|||
FakeShelf = namedtuple(
|
||||
"Shelf", ("identifier", "name", "user", "books", "privacy")
|
||||
)
|
||||
books = models.Edition.viewer_aware_objects(request.user).filter(
|
||||
# privacy is ensured because the shelves are already filtered above
|
||||
shelfbook__shelf__in=shelves.all()
|
||||
).distinct()
|
||||
books = (
|
||||
models.Edition.viewer_aware_objects(request.user)
|
||||
.filter(
|
||||
# privacy is ensured because the shelves are already filtered above
|
||||
shelfbook__shelf__in=shelves.all()
|
||||
)
|
||||
.distinct()
|
||||
)
|
||||
shelf = FakeShelf("all", _("All books"), user, books, "public")
|
||||
|
||||
if is_api_request(request):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue