Django manager model overridden by proxy model

577 views Asked by At

I've got a custom User object and a proxy model inheriting from it (zinnia's auther). The odd thing is that the proxy model seems to be overriding the managers model setting somehow. Goes something like this

 class CustomUserManager(BaseUserManager):
 ....

 class CustomUser(AbstractBaseUser, PermissionsMixin):
 ....

So far everything works fine, but after installing the zinnia plugin (https://github.com/Fantomas42/django-blog-zinnia/) containing the following

class Author(get_user_model()):
    """
    Proxy model around :class:`django.contrib.auth.models.get_user_model`.
    """

    objects = get_user_model()._default_manager
    published = EntryRelatedPublishedManager()

    ...

    class Meta:
        """
        Author's meta informations.
        """
        app_label = 'zinnia'
        proxy = True

After which the following happens: CustomUser.objects.model points to zinnia.models.author.Author

I'm guessing there's something going on in BaseManager.contribute_to_class(...). Any ideas?

0

There are 0 answers