Commit 2f1b2605 authored by Sli's avatar Sli

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 !252
parents 1848945d 60c9498a
Pipeline #2106 passed with stage
in 51 minutes and 25 seconds
......@@ -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(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment