开发者

How to detect type of Form Field in Template in Django

开发者 https://www.devze.com 2023-04-07 12:47 出处:网络
Hi guys i have simple Django Form , but I need to 开发者_如何学运维 gettype ofthis field elements andI madesome special operationsaccording to this.

Hi guys i have simple Django Form , but I need to 开发者_如何学运维 get type of this field elements and I made some special operations according to this.

Is there an easy way to get type of Form Field in Django Template?

Any help will be appreciated.


For your actual use case the image widget from the django-form-utils package should be a good match.

On more general level: If you simply want to modify the html generated by a standard widget you should subclass the widget and tweak the render-method.

Take a look at this blog post to get the basic idea.

0

精彩评论

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