From 33239a097bda2ffc147bf4c94abee183c6b58352 Mon Sep 17 00:00:00 2001 From: Christopher Charbonneau Wells Date: Sun, 17 Sep 2017 09:36:07 -0400 Subject: [PATCH] Add custom form field settings for boolean fields. --- babyblotter/templates/babyblotter/form.html | 61 ++++++++++++++------- 1 file changed, 41 insertions(+), 20 deletions(-) diff --git a/babyblotter/templates/babyblotter/form.html b/babyblotter/templates/babyblotter/form.html index d21a0294..25dd5dfd 100644 --- a/babyblotter/templates/babyblotter/form.html +++ b/babyblotter/templates/babyblotter/form.html @@ -1,22 +1,43 @@ {% load widget_tweaks %} -
- {% csrf_token %} - {% for field in form %} -
- - {% if field.errors %} - {{ field|add_class:"form-control is-invalid" }} - {% else %} - {{ field|add_class:"form-control" }} - {% endif %} - {% if field.help_text %} -

{{ field.help_text }}

- {% endif %} - {% if field.errors %} -

{% for error in field.errors %}{{ error }}{% endfor %}

- {% endif %} -
- {% endfor %} - -
\ No newline at end of file +
+
+ {% csrf_token %} + {% for field in form %} +
{{ field|field_type }}
+
+ {% if field|field_type == 'booleanfield' %} +
 
+
+
+ +
+
+ {% else %} + +
+ {% if field.errors %} + {{ field|add_class:'form-control is-invalid' }} + {% else %} + {{ field|add_class:'form-control' }} + {% endif %} +
+ {% endif %} + {% if field.help_text %} +

{{ field.help_text }}

+ {% endif %} + {% if field.errors %} +

{% for error in field.errors %}{{ error }}{% endfor %}

+ {% endif %} +
+ {% endfor %} + +
+
\ No newline at end of file