Skip to content
Snippets Groups Projects
Commit fc1397af authored by Nadja Geisler's avatar Nadja Geisler :sunny:
Browse files

Merge branch 'fix-slot-defaultlength' into 'main'

Make sure new additional slots have the correct default length

See merge request !125
parents 124169d5 4cf5c190
No related branches found
No related tags found
1 merge request!125Make sure new additional slots have the correct default length
Pipeline #95971 passed
...@@ -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