ibrahimyilmaz
ibrahimyilmaz

Reputation: 18889

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.

Upvotes: 2

Views: 771

Answers (1)

arie
arie

Reputation: 18972

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.

Upvotes: 1

Related Questions