Hello,

I'm trying to figure out a simple way to get a known record from a
database but also get the "previous" and "next" records too. My model
is a Photo table with user's votes :

ID  Votes

1     24
2     5
3     102
4     21
5     10


So, if I query for the photo with ID=4 (21 votes) I'd like to get the
next photo in the votes rank (ID=1 with 24 votes) and the previous
photo in the rank (ID=5 with 10 votes). Can I do this with only one
query to the database? Ideas?

Thanks in advance.
Cheers!




-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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