开发者

What is abstract attribute in a Django model?

开发者 https://www.devze.com 2023-02-21 14:07 出处:网络
What\'s the purpose to define a Django model with abstr开发者_如何学JAVAact = True ?abstract=True means this model is an abstract model class. It does not have a database table and is merely a shared

What's the purpose to define a Django model with abstr开发者_如何学JAVAact = True ?


abstract=True means this model is an abstract model class. It does not have a database table and is merely a shared parent model class so that the child models don't need to rewrite all the fields. Each child models will have their own table.

abstract=False means a normal model, django will create a table for it.

0

精彩评论

暂无评论...
验证码 换一张
取 消