From: Magnus Hagander Date: Fri, 28 Sep 2018 08:54:35 +0000 (+0200) Subject: Plase cancel button in it's own form X-Git-Url: http://git.postgresql.org/gitweb/static/%7B%7Bpgdulink%28?a=commitdiff_plain;h=982be4fc192f78f9574c386dcf83a8dd58e5b2bd;p=pgeu-website.git Plase cancel button in it's own form While we made sure that we didn't validate the form serverside, it would still not be possible to cancel a form wihtout filling out required fields since the *browser* would enforce those. For this reason, put the cancel button in a separate form so it doens't trigger those requirements. --- diff --git a/postgresqleu/confreg/views.py b/postgresqleu/confreg/views.py index ff55583..1e451e5 100644 --- a/postgresqleu/confreg/views.py +++ b/postgresqleu/confreg/views.py @@ -259,6 +259,8 @@ def register(request, confname, whatfor=None): # Did the user click cancel? We want to check that before we # check form.is_valid(), to avoid the user getting errors like # "you must specify country in order to cancel". + # (This is submitted as a separate form in order to avoid client-side + # versions of the same problem) if request.POST['submit'] == 'Cancel registration': if reg.id: reg.delete() diff --git a/template.jinja/confreg/regform.html b/template.jinja/confreg/regform.html index 9006a13..b19516e 100644 --- a/template.jinja/confreg/regform.html +++ b/template.jinja/confreg/regform.html @@ -108,6 +108,8 @@ correction.



+ +
{{ csrf_input }}
{%endblock%}