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
1 merge request!125Make sure new additional slots have the correct default length
Pipeline #95970 passed
This commit is part of merge request !125. Comments created here will be created in the context of that merge request.
......@@ -176,15 +176,6 @@ class AKDurationForm(forms.ModelForm):
'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 Meta:
......
......@@ -365,6 +365,7 @@ class AKSlotAddView(EventSlugMixin, EventInactiveRedirectMixin, CreateView):
initials = super(AKSlotAddView, self).get_initial()
initials['event'] = self.event
initials['ak'] = get_object_or_404(AK, pk=self.kwargs['pk'])
initials['duration'] = self.event.default_slot
return initials
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.
Please register or to comment