开发者

django custom form template checkbox question

开发者 https://www.devze.com 2023-02-08 13:26 出处:网络
Django forms are really easy and nice to style especially if you like to take control of the outcom开发者_C百科e.

Django forms are really easy and nice to style especially if you like to take control of the outcom开发者_C百科e.

A question. Is there anyway you can see whether the {{ field }} type, ie checkbox, radio etc?


you could create a field_type template filter

{{ field|field_type }} = CharField 
{{ field|widget_type }} = TextInput

heres a great example :

http://olivergeorge.posterous.com/django-template-tags-to-find-out-field-type

0

精彩评论

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