开发者

Why I can't see list in template in Django 1.3?

In view function: I have

messages开发者_C百科 = 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 messages variable is in fact overridden by a context processor provided by django.contrib.messages. Try giving your queryset a different name and see if it helps.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜