Hi. Is there any way, how to easily redefine RelatedManager.get_query_set() method?
Here is an example situation: class Table(models.Model): number = models.IntegerField() class Guest(models.Model): confirmed = models.BooleanField() table = models.ForeignKey(Table) objects = ConfirmedManager() possible = models.Manager() class ConfirmedManager(models.Manager): def get_query_set(self): super(ConfirmedManager, self).get_query_set().filter(confirmed=True) In that way, all queries on Guest.objects.all() will automaticly filter only confirmed guests (unless specified by Guest.possible.all()). That's fine. But there is the trick: table_one = Table.objects.get(number=1) table_one.guest_set.all() does not use the ConfirmedManager (and thus filter confirmed only guests), but RelatedManager, whitch I'm not able to overwrite. Is there any way to do that? Or any other kind of implicit filtering? Thanks, Ales PS: This is just a small examle, where the workaround to just apply filter on every queryset is extremely simple. But my real-world case is a lot bigger and more complicated, where explicit filtering on every RelatedManager is far from nice and easy. -- ------------------------------------------------------ Ales Zoulek +420 604 332 515 Jabber: a...@jabber.cz ICQ: 82647256 ------------------------------------------------------ --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---