diff --git a/bookify/books/templates/books/_book_item.html b/bookify/books/templates/books/_book_item.html new file mode 100644 index 0000000..03056de --- /dev/null +++ b/bookify/books/templates/books/_book_item.html @@ -0,0 +1,15 @@ + +
+

+ {{ book.title }} + ({{ book.average_rating }}) +

+

Автор: {{ book.author }}

+ {% if book.genres.all %} +

Жанры: + {% for g in book.genres.all %} + {{ g.name }}{% if not forloop.last %}, {% endif %} + {% endfor %} +

+ {% endif %} +
diff --git a/bookify/books/templates/books/book_list.html b/bookify/books/templates/books/book_list.html index a7b77f5..c423713 100644 --- a/bookify/books/templates/books/book_list.html +++ b/bookify/books/templates/books/book_list.html @@ -1,23 +1,10 @@ + {% extends 'books/base.html' %} {% block content %}

Список книг

{% for book in books %} -
-

- {{ book.title }} - ({{ book.average_rating }}) -

-

Автор: {{ book.author }}

- {% if book.genres.all %} -

Жанры: - {% for g in book.genres.all %} - {{ g.name }} - {% if not forloop.last %}, {% endif %} - {% endfor %} -

- {% endif %} -
+ {% include 'books/_book_item.html' %} {% endfor %}
{% endblock %} diff --git a/bookify/books/templates/books/genre_list.html b/bookify/books/templates/books/genre_list.html index 5321132..a9352f9 100644 --- a/bookify/books/templates/books/genre_list.html +++ b/bookify/books/templates/books/genre_list.html @@ -5,6 +5,7 @@ {% for genre in genres %}
  • {{ genre.name }} + Перейти к книгам {% if user.is_authenticated %} Редактировать diff --git a/bookify/books/templates/books/genre_recommendations.html b/bookify/books/templates/books/genre_recommendations.html index ada6911..7472859 100644 --- a/bookify/books/templates/books/genre_recommendations.html +++ b/bookify/books/templates/books/genre_recommendations.html @@ -1,13 +1,10 @@ - + {% extends 'books/base.html' %} {% block content %}

    Рекомендации по жанру "{{ genre.name }}"

    {% for book in books %} -
    -

    {{ book.title }}

    -

    Автор: {{ book.author }}

    -
    + {% include 'books/_book_item.html' %} {% endfor %}
    {% endblock %}