Hi, phillc wrote: > In reference to > http://simonwillison.net/2008/May/1/orm/ > and comments from here > http://thisweekindjango.com/screencasts/episode/11/django-ground-episode-3/ > <snip>> > so i got to thinking, these posts were made pre-QSRF merge i think? so > is the updated version of the chained manager work around storing Q > objects? > > instead of > > whatever.objects.all().published().catgegory('foo') > > we would have > > whatever.objects.filter(PUBLISHED, CATEGORY) > > or something?
When defining your published method, you could give it an optional parameter, say exclude=False: class PublishedItemsManager(models.Manager): def published(self, exclude=False): if exclude: fn = self.exclude else: fn = self.filter return fn(pub_date__lte=datetime.now()) Then pass exclude=True whenever you need exclusion instead of inclusion. -RD --~--~---------~--~----~------------~-------~--~----~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---