Re: non date-based detail pages: previous/next?
Ian, the only problem with that is that you need to know whether there actually IS a previous or next object. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: non date-based detail pages: previous/next?
you might want to do this 'work' when the user actually requests the page in question, not when you generate the one he is looking at.for example have 2 views defined in urls.pygetnext/(object-id)/getprev/(object-id)/and have these 2 views do the calculation on what is 'next' and issue the 301 redirect's to the real url in question.if you wanted to be really smart you could cache the result so the 2nd person to view the page would get the real url instead of the redirect.(thats how I would do it)but then.. I usually aim for the most complex way possible ;-)regardsianOn 31/07/2006, at 9:24 AM, SmileyChris wrote:jcb wrote: I have a page that lists a bunch of Geolocation objects (using thegeneric view list, works great.) I have a detail page(django.views.generic.list_detail.object_detail) that works great thesame way...displaying one geolocation (with a tiny Google map, nice.) Perhaps the best way is to not use a generic view list page. Instead,why don't you make a simple view which can parse the list, adding innext / prev ids for each item, then return the template.Then in your list template, add the next/prev ids for each item to thequerystring for each detail link.Maybe there's another more genius way, but that's how I'd do it :) --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: non date-based detail pages: previous/next?
jcb wrote: > 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.) Perhaps the best way is to not use a generic view list page. Instead, why don't you make a simple view which can parse the list, adding in next / prev ids for each item, then return the template. Then in your list template, add the next/prev ids for each item to the querystring for each detail link. Maybe there's another more genius way, but that's how I'd do it :) --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
non date-based detail pages: previous/next?
Okay, I've scoured the fine, fine documentation, and, well, nothing. 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.) What I'm stymied about...how do you get 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? (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. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---