Skip to content
Snippets Groups Projects
Commit 4cf5c190 authored by Benjamin Hättasch's avatar Benjamin Hättasch Committed by Nadja Geisler
Browse files

Make sure new additional slots have the correct default length

parent 124169d5
No related branches found
No related tags found
No related merge requests found
...@@ -176,15 +176,6 @@ class AKDurationForm(forms.ModelForm): ...@@ -176,15 +176,6 @@ class AKDurationForm(forms.ModelForm):
'event': forms.HiddenInput 'event': forms.HiddenInput
} }
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.initial = {**self.initial, **kwargs['initial']}
if self.initial.get('duration') == 0:
event_id = self.initial.get('event')
if event_id is not None:
event = Event.objects.get(pk=event_id)
self.initial['duration'] = event.default_slot
class AKOrgaMessageForm(forms.ModelForm): class AKOrgaMessageForm(forms.ModelForm):
class Meta: class Meta:
......
...@@ -365,6 +365,7 @@ class AKSlotAddView(EventSlugMixin, EventInactiveRedirectMixin, CreateView): ...@@ -365,6 +365,7 @@ class AKSlotAddView(EventSlugMixin, EventInactiveRedirectMixin, CreateView):
initials = super(AKSlotAddView, self).get_initial() initials = super(AKSlotAddView, self).get_initial()
initials['event'] = self.event initials['event'] = self.event
initials['ak'] = get_object_or_404(AK, pk=self.kwargs['pk']) initials['ak'] = get_object_or_404(AK, pk=self.kwargs['pk'])
initials['duration'] = self.event.default_slot
return initials return initials
def get_context_data(self, *, object_list=None, **kwargs): def get_context_data(self, *, object_list=None, **kwargs):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment