From 4ed0ca0fbe36dc252d40e94456890a8bb6cdf776 Mon Sep 17 00:00:00 2001 From: Magnus Hagander Date: Mon, 11 Dec 2017 15:29:45 +0100 Subject: [PATCH] Fix submission forms for many2many fields with checkboxes This includes proper styling (no more centering of the checkbox itself) and actually saving the m2m fields on submit. --- media/css/layout.css | 6 +++++- pgweb/util/helpers.py | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/media/css/layout.css b/media/css/layout.css index 308ba5a3..7850f028 100644 --- a/media/css/layout.css +++ b/media/css/layout.css @@ -640,7 +640,7 @@ TABLE.pgGenericFormTable TR { vertical-align: top; } -TABLE.pgGenericFormTable TR TD INPUT, +TABLE.pgGenericFormTable TR TD INPUT:not([type='checkbox']), TABLE.pgGenericFormTable TR TD SELECT, TABLE.pgGenericFormTable TR TD TEXTAREA, TABLE.pgGenericFormTable TR TD DIV.markdownpreview { @@ -671,6 +671,10 @@ TABLE.pgGenericFormTable TR TH.formfieldnamecontainer { max-width: 300px; } +TABLE.pgGenericFormTable TR TD UL { + list-style-type: none; +} + /* Misc Classes */ .pgClearBoth { diff --git a/pgweb/util/helpers.py b/pgweb/util/helpers.py index 87e586ce..b24885bf 100644 --- a/pgweb/util/helpers.py +++ b/pgweb/util/helpers.py @@ -43,6 +43,8 @@ def simple_form(instancetype, itemid, request, formclass, formtemplate='base/for form.apply_submitter(r, request.user) r.save() + form.save_m2m() + return HttpResponseRedirect(redirect) else: # Generate form -- 2.39.5