While going through the code for ModelBase for reviewing [1] it is unclear to me when inheriting from 2 Abstract models which define Managers, if the concrete model should use the first manager according to the creation counter or it should follow the MRO. I would expect the following test to pass. I would appreciate if someone can confirm that this is a bug so we should open a trac ticket and fix this.
@isolate_apps('managers_regress')
def test_multi_abstract_model_inheritance_manager_mro(self):
from django.db.models.manager import Manager
class Manager1(Manager):
pass
class Manager2(Manager):
pass
class AbstractModel1(models.Model):
custom_manager = Manager1()
class Meta:
abstract = True
class AbstractModel2(models.Model):
custom_manager = Manager2()
class ConcreteModel(AbstractModel2, AbstractModel1):
pass
self.assertIsInstance(ConcreteModel.custom_manager, Manager2)
self.assertIsInstance(ConcreteModel._default_manager, Manager2)