Friday, March 4, 2011

Ordering of querysets

Hi,

I have trouble getting a QuerySet to do what I want. I need to select
the last 10 items of a certain model (ordered by timestamp; so the
"most recent" 10 items), and when I iterate over them during template
processing I want the earliest item (with the oldest timestamp) to
come first.

I've tried to achieve this using various combinations of slicing,
reverse(), and ordering on 'timestamp' vs '-timestamp', but I can't
get it to work.

How can this be done?

Regards, 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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate