I need extend a model from another model.
Case:
core/models.py
class City(Master): zipcode = models.IntegerField()
Master is a abstract model.
custom/models.py
from core.models import City class City(City) newfield = models.CharField(max_length=20)
I have tried with proxy model but it is not what I need, since proxy model adds a new table. https://docs.djangoproject.com/en/2.2/topics/db/models/#proxy-models
I need is that when I migrate add the new field to City.
from Inheritance model update to its parent model
No comments:
Post a Comment