mirror of
https://github.com/pretix/pretix.git
synced 2026-05-07 15:34:02 +00:00
Fix minor issues in DateFrameField/DateFrameWidget
This commit is contained in:
@@ -294,7 +294,7 @@ class DateFrameWidget(forms.MultiWidget):
|
|||||||
date.fromisoformat(value.split('/', 1)[0]),
|
date.fromisoformat(value.split('/', 1)[0]),
|
||||||
date.fromisoformat(value.split('/', 1)[-1]),
|
date.fromisoformat(value.split('/', 1)[-1]),
|
||||||
]
|
]
|
||||||
return []
|
return [value, None, None]
|
||||||
|
|
||||||
def get_context(self, name, value, attrs):
|
def get_context(self, name, value, attrs):
|
||||||
ctx = super().get_context(name, value, attrs)
|
ctx = super().get_context(name, value, attrs)
|
||||||
@@ -372,6 +372,8 @@ class DateFrameField(forms.MultiValueField):
|
|||||||
return super().has_changed(initial, data)
|
return super().has_changed(initial, data)
|
||||||
|
|
||||||
def clean(self, value):
|
def clean(self, value):
|
||||||
|
if not value:
|
||||||
|
return None
|
||||||
if value[0] == 'custom':
|
if value[0] == 'custom':
|
||||||
if not value[1] and not value[2]:
|
if not value[1] and not value[2]:
|
||||||
raise ValidationError(self.error_messages['incomplete'])
|
raise ValidationError(self.error_messages['incomplete'])
|
||||||
|
|||||||
Reference in New Issue
Block a user