Skip to content
Snippets Groups Projects
Commit 9c24f662 authored by Todd Dembrey's avatar Todd Dembrey
Browse files

Use the session for the demo page

parent d0eb2304
No related branches found
No related tags found
No related merge requests found
......@@ -6,16 +6,15 @@ from .workflow import SingleStage, DoubleStage
workflows = [SingleStage, DoubleStage]
logs = []
submission: dict = {}
class BasicSubmissionForm(forms.Form):
who_are_you = forms.CharField()
def demo_workflow(request, wf_id):
logs = request.session.get('logs', list())
submission = request.session.get('submission', dict())
wf = int(wf_id)
workflow_class = workflows[wf - 1]
workflow = workflow_class([BasicSubmissionForm] * wf)
......@@ -27,7 +26,7 @@ def demo_workflow(request, wf_id):
if current.stage.name not in submission:
submitted_form = current.stage.form(request.POST)
if submitted_form.is_valid():
submission[current.stage.name] = submitted_form
submission[current.stage.name] = submitted_form.cleaned_data
phase = current
logs.append(
f'{phase.stage}: Form was submitted'
......@@ -50,6 +49,9 @@ def demo_workflow(request, wf_id):
else:
form = None
request.session['logs'] = logs
request.session['submission'] = submission
context = {
'workflow': workflow,
'phase': phase,
......
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