Merge branch 'fix-news-form' into 'master'

Fix 500 when a news needs a start_date and/or end_date but we don't provide

See merge request ae/Sith!252
This commit is contained in:
Antoine Bartuccio 2019-10-17 14:42:41 +02:00
commit 2f1b26053b

View File

@ -230,7 +230,11 @@ class NewsForm(forms.ModelForm):
self.add_error( self.add_error(
"end_date", ValidationError(_("This field is required.")) "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( self.add_error(
"end_date", "end_date",
ValidationError( ValidationError(