Hello,
I know about assigning attributes to widgets, like shown here:
<https://docs.djangoproject.com/en/1.3/ref/forms/widgets/#customizing-
widget-instances>
or here:
<http://stackoverflow.com/questions/401025/define-css-class-in-django-
forms>
However, I want to assign an additional attribute to a formfield,
since we want a css class for a div that is wrapped around the
presentation of a field. I've tried to assign an attribute in the
form's __init__, like:
self.fields['my_field'].div_css = "test"
If I try to fetch it in the template however, it resolves to an empty
string (supposedly the attribute doesn't exist):
{% for field in form.visible_fields %}
<div class="{{ field.div_css }}" >
....
</div>
{% endfor %}
Any help or explanation what goes on inside Django is appreciated.
Regards,
Andreas
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.