sort shelves by latest shelved date

Display the latest 2 books to be shelved in each shelf, when in the homepage feed view.
fixes #1576
This commit is contained in:
Hugh Rundle 2021-10-26 20:17:53 +11:00
parent f2b11c6ad1
commit 097da148be

View file

@ -224,6 +224,7 @@ def get_suggested_books(user, max_books=5):
.filter( .filter(
shelfbook__shelf=shelf, shelfbook__shelf=shelf,
) )
.order_by('-shelfbook__shelved_date')
.prefetch_related("authors")[:limit], .prefetch_related("authors")[:limit],
} }
suggested_books.append(shelf_preview) suggested_books.append(shelf_preview)