python - I how can I return objects in Django? -


the following

model.objects.all()[:10]

will return 10 records ordered primary key. i'm trying objects in reverse order. in other words if highest primary key 5000, i'm trying 5000, 4999, 4998...

i have tried:

model.objects.reverse().all()[:10] 

but not appear affect order

you can do:

model.objects.order_by('-id')[:10] 

Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -