diff --git a/bookwyrm/tests/views/test_user.py b/bookwyrm/tests/views/test_user.py index 055edae2..7518b2bf 100644 --- a/bookwyrm/tests/views/test_user.py +++ b/bookwyrm/tests/views/test_user.py @@ -30,6 +30,14 @@ class UserViews(TestCase): self.rat = models.User.objects.create_user( "rat@local.com", "rat@rat.rat", "password", local=True, localname="rat" ) + self.book = models.Edition.objects.create(title="test") + with patch("bookwyrm.models.activitypub_mixin.broadcast_task.delay"): + models.ShelfBook.objects.create( + book=self.book, + user=self.local_user, + shelf=self.local_user.shelf_set.first(), + ) + models.SiteSettings.objects.create() self.anonymous_user = AnonymousUser self.anonymous_user.is_authenticated = False diff --git a/bookwyrm/views/books.py b/bookwyrm/views/books.py index 2a47c0d2..0c61d1a2 100644 --- a/bookwyrm/views/books.py +++ b/bookwyrm/views/books.py @@ -270,10 +270,10 @@ class Editions(View): if request.GET.get("format"): filters["physical_format__iexact"] = request.GET.get("format") - editions = work.editions.order_by("-edition_rank").all() + editions = work.editions.order_by("-edition_rank") languages = set(sum([e.languages for e in editions], [])) - paginated = Paginator(editions.filter(**filters).all(), PAGE_LENGTH) + paginated = Paginator(editions.filter(**filters), PAGE_LENGTH) data = { "editions": paginated.get_page(request.GET.get("page")), "work": work, diff --git a/bookwyrm/views/user.py b/bookwyrm/views/user.py index 9c79a77c..02db5971 100644 --- a/bookwyrm/views/user.py +++ b/bookwyrm/views/user.py @@ -59,7 +59,7 @@ class User(View): { "name": user_shelf.name, "local_path": user_shelf.local_path, - "books": user_shelf.books[:3], + "books": user_shelf.books.all()[:3], "size": user_shelf.books.count(), } )