Monday, November 11, 2013

Crispy Forms css_classes

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?

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/07f2fbe6-cb74-41cb-b06b-b41e2e8ecf02%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate