wil*_*lex 10 python django overriding class
我在Django模型中有父类和子类.我想在初始化子类时填充父类中的字段.或者在子类中覆盖此字段.
class Parent(models.Model):
type = models.CharField()
class Child(Parent):
type = models.CharField() //Doesn't work
Run Code Online (Sandbox Code Playgroud)
还尝试覆盖init方法,但它也不起作用.我怎么能做到这一点?
| 归档时间: |
|
| 查看次数: |
3734 次 |
| 最近记录: |