I have not tried it with django, so I cannot guarantee this will work, however if I understand what you are attempting.... I was showing an model instance in a view and needed to get the next one by pk I would probably do: model.objects.filter(pk > current_model_instance_id).order_by(id)[:1] which should be the next object in the db, by id ascending for the previous one I would do the same just with the order_by(-id)
Like I said, never done it but I'd give it a try On Sep 15, 1:30 pm, akonsu <[EMAIL PROTECTED]> wrote: > hello, > > in my object_detail view i need to emit links to the previous and next > objects in the object list which invoked this detail view. has anyone > done this? any advice? > > thanks > konstantin --~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---

