I encountered a problem in the Django Girls tutorial, namely: you need to include this line of code in the blog/views.py , adding it to the def post_list(request) function:
from django.shortcuts import render from django.utils import timezone from .models import Post def post_list(request): posts=Post.objects.filter(published_date__lte=timezone.now())\ .order_by('published_date') return render(request, 'blog/post_list.html', {}) After that, I need to reflect the template list of records in the html file for my site
<div> <h1><a href=''>Django Girls Blog</a></h1> </div> {{ posts }} But this code does not work, only the first div displayed. The rest of the posts do not work, and no error appears, so I don’t know how to fix it.
Of course, this is to blame for my clumsy hands, I will be grateful if you open your eyes, what is the catch