开发者

Writing custom Django form fields and widgets

开发者 https://www.devze.com 2022-12-25 05:07 出处:网络
Django has very good documentation that describes how to write custom database fields and custom template tags and filters.I cannot find the document that describes how to write custom form fields and

Django has very good documentation that describes how to write custom database fields and custom template tags and filters. I cannot find the document that describes how to write custom form fields and widgets. Does this document ex开发者_开发问答ist?

The way I've been able to write custom form fields and widgets is by reading the Django source code and imitating what I see there. I know that there are still things about implementing fields and widgets that I do not completely understand because I have not read any high level document that describes their interfaces.


I have not found any good documentation (especially for widgets). I would suggest continuing to do it the way you are, and google specific problems (e.g., "creating a MultiValueField and MultiWidget").


personally I have found the docs on form validation to be very helpful to write custom form fields or to customize form-wide validation (since it's really all about validation isn't?)

https://docs.djangoproject.com/en/dev/ref/forms/validation/

0

精彩评论

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