Fix 500 on news creation/edition

This commit is contained in:
tleb 2019-10-17 10:25:29 +02:00
parent 42f5773f51
commit 60c9498a56
1 changed files with 5 additions and 1 deletions

View File

@ -230,7 +230,11 @@ class NewsForm(forms.ModelForm):
self.add_error(
"end_date", ValidationError(_("This field is required."))
)
if self.cleaned_data["start_date"] > self.cleaned_data["end_date"]:
if (
not self.has_error("start_date")
and not self.has_error("end_date")
and self.cleaned_data["start_date"] > self.cleaned_data["end_date"]
):
self.add_error(
"end_date",
ValidationError(