2011-07-02 45 views
0

这是我见过的最奇怪最不合逻辑的错误。我使用Django + mongoengine,并让说我的看法是:疯狂怪异的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”)

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

回答

0

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

+0

该版本有哪些bug? – dcrosta

+0

即使现在也是可用的..这里是我实际找到解决方案的地方https://github.com/hmarr/mongoengine/issues/190 – hymloth