On supprime la contrainte de date pour permettre des imports ou manipulation d'événements même dans le passé

This commit is contained in:
Jean-Marie Favreau 2023-12-17 15:29:04 +01:00
parent 3520045856
commit 39d8b2a8c1
1 changed files with 0 additions and 11 deletions

View File

@ -29,23 +29,12 @@ class EventForm(ModelForm):
del self.fields['status']
def clean_start_day(self):
start_day = self.cleaned_data.get("start_day")
if start_day is not None and start_day < date.today():
raise ValidationError(_("The start date cannot be earler than today."))
return start_day
def clean_end_day(self):
start_day = self.cleaned_data.get("start_day")
end_day = self.cleaned_data.get("end_day")
if end_day is not None and start_day is not None and end_day < start_day:
raise ValidationError(_("The end date must be after the start date."))
if end_day is not None and end_day < date.today():
raise ValidationError(_("The end date cannot be earler than today."))
return end_day