From 6e9df34452bf2974b6cd90bc389346ee05d168d3 Mon Sep 17 00:00:00 2001 From: Stef Date: Tue, 1 Apr 2025 12:08:56 +0200 Subject: [PATCH] More forms testing --- __pycache__/forms.cpython-312.pyc | Bin 886 -> 880 bytes forms.py | 4 ++-- run.py | 12 +++++++----- templates/forms.html | 2 +- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/__pycache__/forms.cpython-312.pyc b/__pycache__/forms.cpython-312.pyc index c61de8db4e9428e6cffc59aeadb3fecce9865af1..644cca52201c439879baa6379515818b84bcad7a 100644 GIT binary patch delta 106 zcmeyy_JNJ}G%qg~0}vGLc%5FekvD`2tflkpZ;Sz=CRN@7WVQE?SdaB5LmW^$@R zXpoQ9EzXeq)Uy24^whk`t&FBjiMf;aFm|&@U*=Wa?9If(D5*9<^9utrquLi9Mn=vF NoL?D$RFN>y3IH1MAThis is the default page" -@app.route("/forms") +@app.route("/forms", methods=["GET", "POST"]) def forms(): - service_form = ServiceForm() + form = ServiceForm() - if service_form.validate_on_submit: # type: ignore - session["name"] + if form.validate_on_submit: # type: ignore + session["name"] = form.name.data + session["url"] = form.url.data - return render_template("forms.html", form=service_form) + form = ServiceForm(formdata=None) + return render_template("forms.html", form=form) # Prevent execution when imported by other script diff --git a/templates/forms.html b/templates/forms.html index ed55008..87b65de 100644 --- a/templates/forms.html +++ b/templates/forms.html @@ -11,7 +11,7 @@

Hallo

{{ form.hidden_tag() }} - {{ form.naam.label }} {{form.naam}} + {{ form.name.label }} {{form.name}}
{{ form.url.label}} {{form.url}}