Improve support for cross-midnight time slots

This commit is contained in:
Raphael Michel
2020-10-05 17:14:49 +02:00
parent d85583f70a
commit 766428c469
3 changed files with 24 additions and 15 deletions

View File

@@ -2,7 +2,6 @@ from datetime import timedelta
from urllib.parse import urlencode
from django import forms
from django.core.exceptions import ValidationError
from django.forms import formset_factory
from django.urls import reverse
from django.utils.dates import MONTHS, WEEKDAYS
@@ -382,12 +381,6 @@ class TimeForm(forms.Form):
required=False
)
def clean(self):
d = super().clean()
if d.get('time_from') and d.get('time_to') and d['time_from'] > d['time_to']:
raise ValidationError({'time_to': _('The end of the event has to be later than its start.')})
return d
TimeFormSet = formset_factory(
TimeForm,