Set proper startDate and endDate on TimeWidgets.

This commit is contained in:
2018-02-23 12:56:59 +01:00
parent 92482a08e1
commit c836a9c00e

View File

@@ -387,6 +387,7 @@ class ApproachForm(EventCreateForm):
def _proceed_session_data(self, session_data):
super(ApproachForm, self)._proceed_session_data(session_data)
first_day = session_data.get('first_day', None)
last_day = session_data.get('last_day', None)
self.fields['transport_other'].widget.attrs['placeholder'] = _(u'Nebenstehendes Feld beachten')
@@ -395,6 +396,13 @@ class ApproachForm(EventCreateForm):
self.fields['accommodation_other'].widget.attrs['placeholder'] = _(u'Nebenstehendes Feld beachten')
self.fields['meals_other'].widget.attrs['placeholder'] = _(u'Nebenstehendes Feld beachten')
self.fields['meeting_time'].widget.options['startDate'] = first_day.strftime('%Y-%m-%d 00:00:00')
self.fields['meeting_time'].widget.options['endDate'] = first_day.strftime('%Y-%m-%d 23:59:59')
return_day = last_day or first_day
self.fields['return_time'].widget.options['startDate'] = return_day.strftime('%Y-%m-%d 00:00:00')
self.fields['return_time'].widget.options['endDate'] = return_day.strftime('%Y-%m-%d 23:59:59')
if not last_day:
self.fields['basecamp'].widget = forms.HiddenInput()
self.fields['accommodation'].widget = forms.HiddenInput()