How to detect type of Form Field in Template in Django
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.
精彩评论