In view function:
I have
messages = Message.objects.filter(id__gt=int(id))
And print str(len(messages)) is 8
In template, I say {{ messages|length }} , the result is 0. what happened?
I am sure that I referenced the right template, because I printed some random text on page, and I see that. Why I cant’ see the queryset in template? It worked just fine in 1.2.3 I believe, because I’ve been using this hundreds of times.
The most probable cause is that your
messagesvariable is in fact overridden by a context processor provided bydjango.contrib.messages. Try giving your queryset a different name and see if it helps.