P
P
Polimic2020-08-08 10:37:27
Django
Polimic, 2020-08-08 10:37:27

Why is html block not rendered in django?

Hello, the output of html blocks is not working, please help))

{% if latest_arlicles_list %}
                                {% for a in latest_arlicles_list %}
                                    <div class="card">
                                        <div class="card-2">
                                            <div class="image"><img src="{% url 'a.book_image' %}" alt="" class="image"></div>
                                            <div class="title">{{ a.book_title }}</div>
                                            <div class="button"><a href="{% url 'a.book_link' %}" class="download">Посмотреть</a></div>
                                        </div>
                                    </div>
                                {% endfor %}
                            {% else %}
                                Книги не найдены((((
                            {% endif %}

This is views.py
from django.shortcuts import render
from .models import Book
import os
def index(request):
    latest_arlticles_list = Book.objects.all()
    return render(request, 'book/list.html', {'latest_arlticles_list': latest_arlticles_list})

There are objects in the database but they are not displayed on the main page of the site.
As far as I understand, the list does not want to go to the site. ((

Answer the question

In order to leave comments, you need to log in

1 answer(s)
0
0Bannon, 2020-08-08
@0Bannon

you have in every phrase where latest_arlticles_list errors, then arlticles, then arlicles

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question