diff --git a/bookwyrm/templates/landing/landing.html b/bookwyrm/templates/landing/landing.html index 38180c3bf..3879e9875 100644 --- a/bookwyrm/templates/landing/landing.html +++ b/bookwyrm/templates/landing/landing.html @@ -7,41 +7,41 @@
-
+
- {% include 'landing/large-book.html' with book=books.0 %} + {% include 'landing/large-book.html' with book=books.has_description.0 %}
- {% include 'landing/small-book.html' with book=books.1 %} + {% include 'landing/small-book.html' with book=books.no_description.0 %}
- {% include 'landing/small-book.html' with book=books.2 %} + {% include 'landing/small-book.html' with book=books.no_description.1 %}
-
+
- {% include 'landing/small-book.html' with book=books.3 %} + {% include 'landing/small-book.html' with book=books.no_description.2 %}
- {% include 'landing/small-book.html' with book=books.4 %} + {% include 'landing/small-book.html' with book=books.no_description.3 %}
- {% include 'landing/large-book.html' with book=books.5 %} + {% include 'landing/large-book.html' with book=books.has_description.1 %}
diff --git a/bookwyrm/templates/landing/large-book.html b/bookwyrm/templates/landing/large-book.html index b273d4318..467785c53 100644 --- a/bookwyrm/templates/landing/large-book.html +++ b/bookwyrm/templates/landing/large-book.html @@ -5,7 +5,7 @@ {% if book %} {% with book=book %}
-
+
- {% include 'snippets/book_cover.html' with cover_class='is-w-l-mobile is-h-l-tablet is-w-auto align to-b to-l' %} + {% include 'snippets/book_cover.html' with cover_class='is-w-l-mobile is-w-auto align to-b to-l' %} {% include 'snippets/stars.html' with rating=book|rating:request.user %} diff --git a/bookwyrm/views/helpers.py b/bookwyrm/views/helpers.py index f757cec95..0add1469b 100644 --- a/bookwyrm/views/helpers.py +++ b/bookwyrm/views/helpers.py @@ -164,16 +164,21 @@ def is_blocked(viewer, user): def get_landing_books(): """list of books for the landing page""" - return list( - set( - models.Edition.objects.filter( - review__published_date__isnull=False, - review__deleted=False, - review__user__local=True, - review__privacy__in=["public", "unlisted"], - ) - .exclude(cover__exact="") - .annotate(Max("review__published_date")) - .order_by("-review__published_date__max")[:6] + + options = ( + models.Edition.objects.filter( + review__published_date__isnull=False, + review__deleted=False, + review__user__local=True, + review__privacy__in=["public", "unlisted"], ) + .exclude(cover__exact="") + .annotate(Max("review__published_date")) + .order_by("-review__published_date__max") ) + + has_description = options.exclude(description=None).exclude(description="") + return { + "has_description": has_description[:2], + "no_description": options.exclude(id__in=has_description)[:4], + }