On Tue, 2006-07-18 at 05:52 +0000, sasha wrote:
> i'm trying to access the last record to loop over the query set.
> however somehow when i call on Something.objects.order_by("-id")[0] the
> set is truncated and it starts to loop over just the first and last
> objects.

Could you provide a slightly more concrete example? It sounds like you
should just be doing

for item in Something.objects.order_by('-id'):
   ...

Why do you think you need the [0] bit there (which turns it into a
single item query by putting "limit 1" on the end of the SQL)? Have you
tried the more natural approach (just iterating over the queryset) and
it failed to work for some reason?

Malcolm



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to