1👍
✅
from django.shortcuts import render
from .models import Post
from django.utils import timezone
def post_list(request):
posts = Post.objects.filter(publish_Data__lte=timezone.now()).order_by('publish_Data')
return render(request, 'blog/post_list.html', {'posts':posts})
👤sebb
Source:stackexchange.com