From f375280b2272487f975fb8b34cdb30bef0800573 Mon Sep 17 00:00:00 2001 From: Benni Baermann Date: Wed, 18 Nov 2020 12:05:18 +0100 Subject: [PATCH] access to choice in second form --- input/templates/input/extern.html | 1 + input/views.py | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/input/templates/input/extern.html b/input/templates/input/extern.html index f8d051c..6d34447 100644 --- a/input/templates/input/extern.html +++ b/input/templates/input/extern.html @@ -28,6 +28,7 @@ + {{choice}}

Schritt {{ wizard.steps.step1 }} von {{ wizard.steps.count }}

{% csrf_token %} diff --git a/input/views.py b/input/views.py index 6233fef..9017cd7 100644 --- a/input/views.py +++ b/input/views.py @@ -142,10 +142,17 @@ class ExternView(CookieWizardView): form = ListForm(data) else: raise RuntimeError(f'ERROR! UNKNOWN FORMTYPE {choice} in ExternView') + self.choice = choice else: form = super().get_form(step, data, files) 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): print('ExternView.done() reached') # gather data from all forms