It's probably best to do this in a custom Manager.
This code is based on this answer: http://markmail.org/message/kwwuskco4gilej2w
You get the idea
class GetPrevNextManager(models.Manager):
def get_next_by_id(self, object):
qs = self.filter(id__gt=object.id)
if qs.count() > 0:
Hi all,
Need help, advice on how the have a next and previous link on a object
detail page. For example fomr a object list page a user chose an
object, and in the object page instead of going back to the list to
view other object the user just click either next or previous.
Any idea how to implem
2 matches
Mail list logo