Is there a model MultiField (any way to compose db models Fields in Django)? Or why would not that be a useful concept?

后端 未结 1 822
自闭症患者
自闭症患者 2021-01-16 07:43

When building a Django application, we were exposed to (forms) MultiValueField and MultiWidget.

They seem like an interesting approach to c

相关标签:
1条回答
  • 2021-01-16 08:28

    Possible: Yes. You could either subclass djangos model class, or monkey-patch that class into the existing model module.

    Just (educated) guessing: I think it is not missing, but not needed.

    In DB-Applications, combined fields will almost always come with special business rules. So you will have to implement a different display and validation for each one of them anyway.

    Which you already can easily do in the models.Form.

    Maybe you should look at customization of models.Form?

    0 讨论(0)
提交回复
热议问题