开发者

Insanely weird django-mongoengine error

开发者 https://www.devze.com 2023-03-17 02:26 出处:网络
This is the most weird and illogical error I have ever seen. I am using django+mongoengine, and lets say my view is:

This is the most weird and illogical error I have ever seen. I am using django+mongoengine, and lets say my view is:

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
        pri开发者_C百科nt i.title # ok, prints correctly all the titles ordered_by "-date_added"

    return render_to_response( template_name, locals(), context_instance=RequestContext(request))

But when I loop through articles in index.html, those are always presented as if the ordering was order_by('date_added')

Am I drunk? Am I missing something? Any suggestions? This is gonna drive me crazy...


SOLVED: This was actually an issue with mongoengine's version. Just install from the dev branch of mongoengine...

0

精彩评论

暂无评论...
验证码 换一张
取 消