Hi Tom,

> Unless I'm being dense, you cannot represent this as a single SQL
> query, so logically you cannot represent this as a QuerySet.

It is possible by using a nested query, e.g.

SELECT * FROM (SELECT * FROM some_table ORDER BY timestamp DESC LIMIT 10)
ORDER BY timestamp ASC;

But I suppose QuerySets are designed to map onto a single, non-nested query
(I don't know the innards of Django I'm afraid) so such a construct would be
out of reach.

An alternative would be to augment querysets such that it would be possible
to iterate over them in reverse order.

> Dropping to a little python, it is trivial

True, but I had hoped it would be possible without doing that.

Thanks, Sidney

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to