I'm using custom validation error in Django 1.6 and it's working great; however, I can only display one error at a time. How do I go about displaying all errors if the condition in the "if" statements failed?
forms.py
class BaseNameFormSet (BaseFormSet):
...
...
...
if (firstname in firstnames) or (lastname in lastnames):
raise forms.ValidationError ('First or last name must be unique')
if (firstname == '') or (lastname == ''):
raise forms.ValidationError ('Both first and last name must be filled out')
addname.html
...
...
...
{% if formset.non_form_errors %}
<b>Please correct the error below:</b>
<ul>
{% for error in formset.non_form_errors %}
<li><p style="color: red;"> {{ error }} </p></li>
{% endfor %}
</ul>