mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-23 18:11:09 +00:00
User viewer aware objects for feed suggested books
This commit is contained in:
parent
ba4df5b38b
commit
36c00c49ab
1 changed files with 5 additions and 3 deletions
|
@ -168,9 +168,11 @@ def get_suggested_books(user, max_books=5):
|
||||||
shelf_preview = {
|
shelf_preview = {
|
||||||
"name": shelf.name,
|
"name": shelf.name,
|
||||||
"identifier": shelf.identifier,
|
"identifier": shelf.identifier,
|
||||||
"books": shelf.books.order_by("shelfbook").prefetch_related("authors")[
|
"books": models.Edition.viewer_aware_objects(user)
|
||||||
:limit
|
.filter(
|
||||||
],
|
shelfbook__shelf=shelf,
|
||||||
|
)
|
||||||
|
.prefetch_related("authors")[:limit],
|
||||||
}
|
}
|
||||||
suggested_books.append(shelf_preview)
|
suggested_books.append(shelf_preview)
|
||||||
book_count += len(shelf_preview["books"])
|
book_count += len(shelf_preview["books"])
|
||||||
|
|
Loading…
Reference in a new issue