Django Forms: error displaying -
i have following code:
{% if form.errors %} <div class="alert alert-danger" role="alert"> <span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span> <span class="sr-only">error:</span> {{ form.errors }} </div> {% endif %}
this produced following:
i remove bullet points , not include __ __ part.
any appreciated, many thanks, alan.
incase may helpful clean part of form follows:
def clean(self): cleaned_data = self.cleaned_data # individual field's clean methods have been called team1 = cleaned_data.get("team1") team2 = cleaned_data.get("team2") if team1 == team2: raise forms.validationerror("you picked same team!") return cleaned_data
you can try doing this:
{% if form.errors %} {% error in form.errors %} <div class="alert alert-danger" role="alert"> <span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span> <span class="sr-only">error:</span> {{ error }} </div> {% endfor %} {% endif %}
i believe should work. output that?
Comments
Post a Comment