python - Django model inheritence query -
say have class in app:
class something(models.model): pass but don't want class inherit models.model, want inherit own custom class, let's phone call 'bettermodel'.
multiple inheritence doesn't work in situation can't do:
import class newclass(something, bettermodel): pass are there other options other fork app?
you can straight import parent "bettermodel". long improve model implements models.model should good.
additionally, django back upwards multiple inheritance of models should able extend 2 different classes long extend models.model.
additional resources: https://docs.djangoproject.com/en/dev/topics/db/models/#model-inheritance https://docs.djangoproject.com/en/dev/topics/db/models/#multiple-inheritance
python django
No comments:
Post a Comment