You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The ExtensibleModelBase class lets you define models that link to other models, creating a chain of inheritance. By defining django models in:
/extensions/[app_to_extend]/[model_to_extend].py
you can get new top-level properties on the object.
In order for your base model class to support this you must add the following line:
metaclass = ExtensibleModelBase
Additionally the django models defined in the file should be declared abstract, since they won’t be instantiated.
See the Contact model in the rapidsms core for an example of a model that can be extended, and the contact.py file in the locations/extensions/rapidsms contrib app folder for an example of it being extended. The end result of these two classes is that a .location is available on instances of Contact models as a foreign key to the Location table.