Re: override get_next_by_FOO() / get_previous_by_FOO()

2007-06-30 Thread orestis
I have defined a dictionary of lookup arguments in my manages so I can reuse them everywhere I want the same behavior... On Jun 10, 3:12 am, Jonathan Stockdill <[EMAIL PROTECTED]> wrote: > I found myself in a similar position and used the following: > def get_next_pub(self): >return

Re: override get_next_by_FOO() / get_previous_by_FOO()

2007-06-14 Thread Malcolm Tredinnick
On Sat, 2007-06-09 at 20:12 -0400, Jonathan Stockdill wrote: > I found myself in a similar position and used the following: > def get_next_pub(self): >return self.get_next_by_pub_date(pub_date__lt=datetime.now > (),is_draft=False) > def get_previous_pub(self): >return se

Re: override get_next_by_FOO() / get_previous_by_FOO()

2007-06-09 Thread Jonathan Stockdill
I found myself in a similar position and used the following: def get_next_pub(self): return self.get_next_by_pub_date(pub_date__lt=datetime.now (),is_draft=False) def get_previous_pub(self): return self.get_previous_by_pub_date(pub_date__lt=datetime.now (),is_draft=False)

Re: override get_next_by_FOO() / get_previous_by_FOO()

2007-05-08 Thread Malcolm Tredinnick
On Mon, 2007-05-07 at 22:32 +, roderikk wrote: > Hi all, > > I have recently started with django and have been able to do good work > with the excellent documentation. Thank you. > > However, now I am a little baffled. I have created a gallery app. The > model exists of a Gallery and Photo w

Re: override get_next_by_FOO() / get_previous_by_FOO()

2007-05-08 Thread roderikk
Well, sorry to be replying to myself but I have tried to solve it in the following way: I implemented these functions/properties in the model: def _get_next_item_ID(self): photo_list = [x for x in self.gallery.photo_set.all()] ind = photo_list.index(self)+1 return pho