0

这是我见过的最奇怪和最不合逻辑的错误。我正在使用 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')

我喝醉了吗?我错过了什么吗?有什么建议么?这会让我发疯...

4

1 回答 1

0

已解决:这实际上是 mongoengine 版本的问题。只需从 mongoengine 的 dev 分支安装...

于 2011-07-03T15:24:28.107 回答