django - set the css class of a form widget based on the data -
the attrs
attribute of widget allows define html attributes. example, setting widget.attrs['class'] = 'class1 class2'
add together class="class1 class2"
on rendered widget.
however, how can set them based on data? display update form , i'd alter css class based on info going displayed when form rendered.
where check info in order alter attrs
property of widget before rendered?
thanks
you have info in context, should able {% if %} testing info want alter class
django django-forms
No comments:
Post a Comment