Aug 022009

Use
Python’s standard list-slicing syntax.
———–
e.g.,
>>>Card.objects.order_by(”name”)[0]
First one only
>>>Card.objects.order_by(”name”)[0:2]
The first two objects will be returned

Posted by weboom at 5:51 am Tagged with: , , ,
Aug 022009

Use
objects.order_by()
—————-
e.g.,
>>>Card.objects.order_by(”name”)
for reverse order
>>>Card.objects.order_by(”-name”)

Posted by weboom at 5:40 am Tagged with: , , ,
Switch to our mobile site
Top Footer