Re: Next previous links from a query set / generi views

2010-02-08 Thread eaman
On Feb 8, 3:38 am, Eric Abrahamsen wrote: [CUT] > Now that you've got a date attribute, why not use that for next and   > previous? 1. Date based next and prev go throught the whole photo set, but I prefer next and prev to provide only items inside a gallery. But I guess that's just me unable to p

Re: Next previous links from a query set / generi views

2010-02-07 Thread Eric Abrahamsen
On Feb 8, 2010, at 7:56 AM, eaman wrote: I'm up to code those two methods... If some one is interested in this thread I managed to code these two methods: get_next | get_prev in order to get a previous or next item in a set right from my model: - http://dpaste.com/155961/ Now that you've got

Re: Next previous links from a query set / generi views

2010-02-07 Thread eaman
> I'm up to code those two methods... If some one is interested in this thread I managed to code these two methods: get_next | get_prev in order to get a previous or next item in a set right from my model: - http://dpaste.com/155961/ - Is there a better way to get the highest 'previous' item then

Re: Next previous links from a query set / generi views

2010-02-07 Thread eaman
On Feb 7, 2:56 pm, Eric Abrahamsen wrote: > On Feb 7, 2010, at 8:54 PM, eaman wrote: [CUT] > The lazy option would probably be to add get_next() and get_previous()   > methods to your model, that return an instance based on whatever   > definition of "next" and "previous" works for you. You migh

Re: Next previous links from a query set / generi views

2010-02-07 Thread Eric Abrahamsen
On Feb 7, 2010, at 8:54 PM, eaman wrote: On Feb 7, 3:24 am, Eric Abrahamsen wrote: Yup, if you have non-null date/datetime fields on your model, each model will automatically get "get_next_by_FOO" and "get_previous_by_FOO" methods, where FOO is the name of the datetime Well I guess the 'La

Re: Next previous links from a query set / generi views

2010-02-07 Thread eaman
On Feb 7, 3:24 am, Eric Abrahamsen wrote: > Yup, if you have non-null date/datetime fields on your model, each   > model will automatically get "get_next_by_FOO" and   > "get_previous_by_FOO" methods, where FOO is the name of the datetime   Well I guess the 'Lazy' optiond is to add a date field

Re: Next previous links from a query set / generi views

2010-02-06 Thread Eric Abrahamsen
Yup, if you have non-null date/datetime fields on your model, each model will automatically get "get_next_by_FOO" and "get_previous_by_FOO" methods, where FOO is the name of the datetime field: http://docs.djangoproject.com/en/1.1/ref/models/instances/#django.db.models.Model.get_next_by_FOO