Do Django models inherit managers? (It seems to me like not)

I have 2 models:

class A(Model): #Some Fields objects = ClassAManager() class B(A): #Some B-specific fields 

I would expect B.objects give me access to an instance of ClassAManager , but that is not the case.

 >>> A.objects <app.managers.ClassAManager object at 0x103f8f290> >>> B.objects <django.db.models.manager.Manager object at 0x103f94790> 

Why doesn't B inherit the objects attribute from A ?

+4
source share
1 answer

Your base class must be an abstract base class so that the inherited user can be inherited as described here

+2
source

Source: https://habr.com/ru/post/1304302/


All Articles