Browse Source

access to choice in second form

master
Benni Baermann 4 years ago
parent
commit
f375280b22
2 changed files with 8 additions and 0 deletions
  1. +1
    -0
      input/templates/input/extern.html
  2. +7
    -0
      input/views.py

+ 1
- 0
input/templates/input/extern.html View File

@ -28,6 +28,7 @@
</style> </style>
<img src="{% static 'input/logo.png' %}" /> <img src="{% static 'input/logo.png' %}" />
{{choice}}
<p>Schritt {{ wizard.steps.step1 }} von {{ wizard.steps.count }}</p> <p>Schritt {{ wizard.steps.step1 }} von {{ wizard.steps.count }}</p>
<form action="" method="post"> <form action="" method="post">
{% csrf_token %} {% csrf_token %}

+ 7
- 0
input/views.py View File

@ -142,10 +142,17 @@ class ExternView(CookieWizardView):
form = ListForm(data) form = ListForm(data)
else: else:
raise RuntimeError(f'ERROR! UNKNOWN FORMTYPE {choice} in ExternView') raise RuntimeError(f'ERROR! UNKNOWN FORMTYPE {choice} in ExternView')
self.choice = choice
else: else:
form = super().get_form(step, data, files) form = super().get_form(step, data, files)
return form return form
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
if hasattr(self, 'choice'):
context["choice"] = self.choice
return context
def done(self, form_list, **kwargs): def done(self, form_list, **kwargs):
print('ExternView.done() reached') print('ExternView.done() reached')
# gather data from all forms # gather data from all forms

Loading…
Cancel
Save