On 9/4/06, Nate Straz <[EMAIL PROTECTED]> wrote: > > On Sun, Sep 03, 2006 at 11:26:22PM +0100, Konstantin Shaposhnikov wrote: > > On 9/3/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > My problem is that my older/newer navigation that uses > > > entry.get_next_by_pub_date also picks up unpublished entries. Is there > > > a way to tell get_next_by_pub_date to use the manager "published" > > > instead of "objects?" > > > > You can pass additional filter arguments to get_next_by_pub_date > > method like this: > > entry.get_next_by_pub_date(is_published = True) > > Is there a way to do this inside a template? > > I ended up defining new functions on the Entry model to keep calling > get_next_by_pub_date until it got to a published entry.
It is possible to use keyword arguments to implement such method more efficiently (and with less code) : def get_next_published(self): return self.get_next_by_pub_date(is_published = True) In this case only one SQL query will be executed. > Nate > > > > -- http://step-inside.org --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---