2011-07-02 43 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