Cross-application model inheritence broken after newforms-admin merge
|Reported by:||jbalonso||Owned by:||nobody|
|Component:||Database layer (models, ORM)||Version:||master|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
I have an application that needs to register models for the admin interface in one app that also has a base class for models in two other apps. After the newforms-admin merge, it is impossible to import the base class into another app, since it needs to be referenced by an app.model name string instead of the class reference itself.
My recommendation is to create a models.base_class() function that accepts an app.model string and returns a dynamic class that can be derived. If such a beast already exists, it needs to be documented.
from django.db import models from remote.models import Foo class Bar(Foo): # etc.
from django.db import models class Bar(models.base_class('remote.Bar')): # etc.