mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-27 12:01:14 +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 = {
|
||||
"name": shelf.name,
|
||||
"identifier": shelf.identifier,
|
||||
"books": shelf.books.order_by("shelfbook").prefetch_related("authors")[
|
||||
:limit
|
||||
],
|
||||
"books": models.Edition.viewer_aware_objects(user)
|
||||
.filter(
|
||||
shelfbook__shelf=shelf,
|
||||
)
|
||||
.prefetch_related("authors")[:limit],
|
||||
}
|
||||
suggested_books.append(shelf_preview)
|
||||
book_count += len(shelf_preview["books"])
|
||||
|
|
Loading…
Reference in a new issue