Tuesday, June 14, 2011

Django objects.all() reverse or descending order

objects.all().order_by('-id') ... or negative whatever the field name is.

I don't know why this didn't work for me: objects.all().reverse()

5 comments:

  1. Just use objects.all().order_by('-id') , because reverse() doesn't works for me too.

    ReplyDelete
  2. i love it your blog it's help me alot....becoz I'm creating simple notice board app..i'm stuck on that part when administrator post a new post or image it will be show on top...so i was looking for a solution to this problem so i checked your blog and my problem revolved within 5 second 💜💜💜❤❤ thanks nd happy coding 😀😀

    ReplyDelete