Hi,

I'd like to use a custom error_class for formatting errors like this:

form = ContactForm(data, auto_id=False, error_class=SpanErrorList)

This works fine as long as the template contains

{{ form.as_p }}

but if I want to use a more flexible output

<dl>
{% for field in form %}
    <dt>{{ field.label_tag }}</dt>
    <dd>{{ field }} {% if field.errors %}{{ field.errors }}{% endif
%}</dd>
{% endfor %}
</dl>

the generic ErrorList format (<ul class="errorlist">) is used. I read
that printing the error adds the <ul> tag (http://
www.djangoproject.com/documentation/forms/#more-granular-output):

>>> f['message'].errors
[u'This field is required.']
>>> print f['message'].errors
<ul class="errorlist"><li>This field is required.</li></ul>

How can I override the tag that's added when printing?

Thanks,
Jan
--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to