Hi there,

I'm just getting an understanding around how managers from abstract
models are applied to a subclass model and it appears as though if a
model inherits from two abstract models that each define a manager
with the same attribute name, eg "objects", then normal mro applies
and the derived model picks up the manager from the one abstract model
and loses the other one. What are people's thoughts around changing
this behaviour so that the derived model's "objects" attribute is
actually a newly created type, using each of the abstract models'
managers as the bases for the new manager?

For example the calls at the end of this would work:

class ManagerA(Manager):
    def methodA(self):
        pass

class ModelA(Model):
    objects = ManagerA()
    class Meta:
        abstract = True

class ManagerB(Manager):
    def methodB(self):
        pass

class ModelB(Model):
    objects = ManagerB()
    class Meta:
        abstract = True

class ModelC(ModelA, ModelB):
    pass

ModelC.objects.methodA()
ModelC.objects.methodB()

It seems to me that this would be desired behaviour especially if the
abstract models are parts from separate applications that weren't
aware of each other, with each of their managers providing required
functionality.

I've started working on a patch for this and I'm just looking for some
feedback before I go any further.

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en.

Reply via email to