0
我有以下代碼:Django的形式:錯誤顯示
{% 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 %}
這產生如下:
我想刪除的要點,而不是包括__所有__部分。
任何幫助將不勝感激,非常感謝,艾倫。
櫃面它可能有助於形式的清潔部分如下:
def clean(self):
cleaned_data = self.cleaned_data # individual field's clean methods have already been called
team1 = cleaned_data.get("team1")
team2 = cleaned_data.get("team2")
if team1 == team2:
raise forms.ValidationError("You picked the same team!")
return cleaned_data