【发布时间】:2011-07-02 18:12:17
【问题描述】:
这是我见过的最奇怪和最不合逻辑的错误。我正在使用 django+mongoengine,可以说我的观点是:
def index(request, template_name='index.html'):
articles = Article.objects.order_by('-date_added')
for i in articles: # test to see if the ordering works
print i.title # ok, prints correctly all the titles ordered_by "-date_added"
return render_to_response( template_name, locals(), context_instance=RequestContext(request))
但是当我遍历 index.html 中的文章时,它们总是显示为好像排序是 order_by('date_added')
我喝醉了吗?我错过了什么吗?有什么建议么?这会让我发疯...
【问题讨论】:
标签: django mongoengine