开发者

Possible form field types per model field type

开发者 https://www.devze.com 2023-01-01 08:29 出处:网络
Django\'s documentation specifies for each model field type the corresponding default form field type.

Django's documentation specifies for each model field type the corresponding default form field type. Alas, I couldn't find in the documentation, or anywhere el开发者_StackOverflow中文版se, what form field types are possible per model field type. Not all combinations are possible, right?

Same question for widgets...


There's a difference between what is possible in the sense of Django will allow you to do it and possible in that it will actually work. Django does not restrict which field types you can use so all combinations are possible in that sense. Some likely wouldn't make sense and others wouldn't work at all like using an forms.ImageField for a models.IPAddressField. It is up to the developer to know the difference.

0

精彩评论

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