Improved ChainedForm.
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user