Crispy Forms css_classes

91 views
Skip to first unread message

sbrandt

unread,
Nov 11, 2013, 5:47:28 PM11/11/13
to django...@googlegroups.com
Hello,

I'm using crispy forms with zurb foundation. Since crispy-forms-foundation isn't that advanced, I need to develop it further by myself. So I've encountered a problem. I need to change the CSS classes of the surrounding div dynamically:

<div class="row">
<div id="div_id_title" class="CLASS NEEEDED HERE">
<label class="requiredField" for="id_title">
<input id="id_title" class="large-12 columns textinput textInput" type="text" name="title" maxlength="50">
</div>
</div>

The template (django_crispy_forms/templates/***/field.html) says: <div id= [...] class="[...]{% if field.css_classes %} {{ field.css_classes }}{% endif %}">

field.css_classes is always empty. The above HTML has been created with the following crispy forms layout:

self.helper.add_layout(Layout(Row(Field('title', css_class='large-12 columns')), [...] ))

As you can see, the css_class is present in the input, but I need it in the div_id_title.

Any ideas?
Reply all
Reply to author
Forward
0 new messages