0
I’m following a tutorial for modeling a BLOG through the DJANGO . In one of the processes, I create an object with the site posts and order them through the publication date:
def post_list(request):
posts = Post.objects.filter(published_date__lte=timezone.now()).order_by('published_date')
return render(request, 'post/post_list.html',{'posts' : posts})
I know through the shell that I own at least one object, because:
Post.objects.all()
<QuerySet [<Post: Post1>, <Post: Objeto1 - Postagem>]>
But when I seek to verify the object that returns through the filter application appears:
Post.objects.filter(published_date__lte=timezone.now()).order_by('published_date')
<QuerySet []>
Can anyone explain to me what the parameter means published_date__lte and why is not returning the object?
Maybe, I’m not sure, I’m filtering all posts now (timezone.now()
) and so does not filter my post. Anyway, I wish someone could explain me better this filter.
Sincerely yours.