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 に答える