开发者

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.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜