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:
parent
3520045856
commit
39d8b2a8c1
@ -29,23 +29,12 @@ class EventForm(ModelForm):
|
|||||||
del self.fields['status']
|
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):
|
def clean_end_day(self):
|
||||||
start_day = self.cleaned_data.get("start_day")
|
start_day = self.cleaned_data.get("start_day")
|
||||||
end_day = self.cleaned_data.get("end_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:
|
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."))
|
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
|
return end_day
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user