[英]Integrate current models from models.Model to BaseModel django
I've some models from models.Model in django and wish to know if I change it and extend to BaseModel will occur some error when I make migrations. 我在Django中有来自models.Model的模型,希望知道是否进行更改并扩展到BaseModel时会发生一些错误。 Thanks 谢谢
否。如果您的BaseModel
扩展了models.Model
。
If BaseModel
is abstract, then changing a model to inherit from models.Model
to BaseModel
will not require a migration. 如果BaseModel
是抽象的,则更改模型以从models.Model
继承为BaseModel
将不需要迁移。
If BaseModel
is not abstract, then you are switching to multi-table inheritance, and migrations will be required. 如果BaseModel
不是抽象的,则您将切换到多表继承,并且将需要迁移。
See the Django docs on inheritance for more info. 有关更多信息,请参见关于继承的Django文档。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.