From 50b7f216fe9457e104df69e3bfc5f85a2d37d0e6 Mon Sep 17 00:00:00 2001 From: Benni Baermann Date: Tue, 29 Sep 2020 11:47:29 +0200 Subject: [PATCH] form workflow fixed --- input/templates/input/project.html | 2 +- input/views.py | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/input/templates/input/project.html b/input/templates/input/project.html index dc75c44..e751efb 100644 --- a/input/templates/input/project.html +++ b/input/templates/input/project.html @@ -1,4 +1,4 @@ -
+ {% csrf_token %} {{ form }} diff --git a/input/views.py b/input/views.py index aa762f3..da60a50 100644 --- a/input/views.py +++ b/input/views.py @@ -9,11 +9,17 @@ def index(request): # return HttpResponse("Hello, world. You're at the input form") # ProjectFormSet = modelformset_factory(Project, fields='__all__') if request.method == 'POST': + print('POST detected') form = ProjectForm(request.POST, request.FILES) if form.is_valid(): + print('form valid') form.save() + # do something. + else: + print("form not valid") else: + print form = ProjectForm() return render(request, 'input/project.html', {'form': form})