简体   繁体   English

将当前模型从model.Model集成到BaseModel django

[英]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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM