Saturday, July 31, 2010

Form label suffix

Hello,

If i do following, it works:

>>> form = ContactForm(label_suffix=":")
>>> print form
<tr><th><label for="id_name">Your name:</label>...


but here it is missing ':':

>>> form['name'].label_tag()
u'<label for="id_name">Your name</label>'

I need to customize form output, so I can not use print form or as_p(),
etc. and I am using following:

{% for field in form %}
{% if not field.is_hidden %}
<div>
{{ field.label_tag }}
{{ field.errors }}
{{ field }}
<p>
{{ field.help_text}}
</p>
</div>
{% else %}
{{ field.as_hidden }}
{% endif %}
{% endfor %}

What I have to do to add the label suffix?

Thanks,
Martin

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment