Improved ChainedForm.

This commit is contained in:
2018-01-20 16:38:28 +01:00
parent 346249f623
commit 873976199f
2 changed files with 25 additions and 9 deletions

View File

@@ -137,7 +137,7 @@ class EventAcceptView(EventDetailView):
class EventCreateView(generic.FormView):
initial_form_class = forms.ModeForm
form_class = forms.EventCreateForm
template_dir = os.path.join('dav_events', 'event_create')
default_template_name = 'default.html'
abort_url = reverse_lazy('dav_events:home')
@@ -160,7 +160,9 @@ class EventCreateView(generic.FormView):
if not issubclass(form_class, forms.ChainedForm):
raise SuspiciousOperation('Invalid next form: {}'.format(form_name))
else:
form_class = self.initial_form_class
base_form_class = self.form_class
initial_form_name = base_form_class.get_initial_form_name()
form_class = getattr(forms, initial_form_name)
return form_class