Opened 12 years ago

Closed 12 years ago

#2509 closed enhancement (wontfix)

django.views.generic.list_detail.object_detail and previous/next

Reported by: jcburns@… Owned by: Jacob
Component: Generic views Version:
Severity: normal Keywords: previous next generic.list
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


I have a page that lists a bunch of Geolocation objects (using the generic view list, works great.) I have a detail page (django.views.generic.list_detail.object_detail) that works great the same way...displaying one geolocation (with a tiny Google map, nice.) But when it comes to getting a reference to the previous and next geolocations in the result so you can have links on the page for previous geolocation and next geolocation? That functionality appears to be missing.

(The primary key IDs are not consecutive...they are mostly, but there are gaps.)

This seems like something fundamental and generic-ish, hence my attempt to use a generic view. Would you consider passing references to the previous object and next object into django.views.generic.list_detail.object_detail so that it's easy to implement this important function from your (otherwise powerful) generic views?

Change History (2)

comment:1 Changed 12 years ago by jcburns@…

Ticket # 10 is not a dupe but speaks to the kind of generic functionality--non-date-based ordering, and where an object is in the stack--that I'm talking about.

comment:2 Changed 12 years ago by Malcolm Tredinnick

Resolution: wontfix
Status: newclosed

Working out what is the right thing to populate the "previous" and "next" links with is very specific to the model. If you want to do this, you should work out the values yourself -- possibly in a little custom view that does the computation prior to passing off the real work to the generic view -- and then pass them as part of the extra_context dictionary to the generic view function. These values will then be available with whatever names you choose to give them in your template.

Note: See TracTickets for help on using tickets.
Back to Top