Hi, I've got a problem with a custom manager on an abstract model. I've something like this:
class CommonModelManager(models.Manager): def get_query_set(self): return super(CommonModelManager, self).get_query_set().filter (time_deleted__isnull=True).filter (registration_site=Site.objects.get_current()) class CommonModel(models.Model): author = models.ForeignKey(User) [other fields...] registration_site = models.ForeignKey(Site, blank=True, null=True, editable=False) objects = CommonModelManager() class Meta: abstract = True class Image(CommonModel): image = ImageWithThumbnailsField([...]) title = models.CharField(_('title'), max_length=65, blank=True) caption = models.TextField(_('caption'), blank=True, max_length=512) albums = models.ManyToManyField('Album', verbose_name=_('album'), blank=True) So, I have Image with a ForeignKey to User related to current Site. I want to retrieve all images in current site from a user (a user can be on multiple sites), using: user.image_set.all() but I can't, because I can't filter results in this type of manager subclass ( http://docs.djangoproject.com/en/dev/topics/db/managers/#writing-correct-managers-for-use-in-automatic-manager-instances ). An ugly solution may be: Image.objects.filter(author=user) But I think that that the most elegant solution is the one with image_set and, if possible, I would like to use the elegant solution! Any ideas to solve this problem? Thanks, Paolo --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---