Answer the question
In order to leave comments, you need to log in
In django, for doesn't output anything?
There is an html template, there is for, there are views.
Everything is as it should be, but it still does not display anything.
I am attaching the code.
<section class="content">
<div class="container-fluid">
{% for post in posts %}
<div class="content-header">
<div class="row">
<div class="col-lg-12">
<div class="content-header-blog">
<h2> {{ post.topic }} </h2>
<a href="blog.html">{{ post.article_title }}</a>
<p class="description"> {{ post.description }}</p>
<h4> {{ post.author }}</h4>
<p> {{ post.date }}</p>
</div>
</div>
</div>
</div>
{% endfor %}
</div>
</section>
posts = {
'topic':'Главная страница блога',
'article_title':'Привет',
'description':'Описание',
'author':'SaveMe',
'date':'25.07.2020'
}
data = {
'posts': posts,
'title': 'Привет'
}
def home(request):
return render(request, 'blog/home.html', data)
post.topic
posts.topic
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question