阅读背景:

Django:为可重用模型字段创建Mixin

来源:互联网 

I've got a few fields that I want to add to most every model in my project. For example, these fields are "tracking fields" such as a created date, an update date, and an "active" flag. I'm attempting to create a Mixin that I could add to each model class that would allow me to add these extra fields via multiple inheritance. However, when an object instance is created, it appears that my model fields that were added via the Mixin show up as methods of the object rather than database fields. I've got a few fields that I want to add to mos




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: