From 5126b6e316d096a291e12efe4eb36881654be47e Mon Sep 17 00:00:00 2001 From: Charles Shin Date: Mon, 20 Feb 2017 18:16:12 -0800 Subject: [PATCH] Added checkbox option tag --- edivorce/apps/core/templates/pdf/form1.html | 13 +++++++++---- edivorce/apps/core/templatetags/input_field.py | 8 ++++++++ 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/edivorce/apps/core/templates/pdf/form1.html b/edivorce/apps/core/templates/pdf/form1.html index a9e12726..374bc4b1 100644 --- a/edivorce/apps/core/templates/pdf/form1.html +++ b/edivorce/apps/core/templates/pdf/form1.html @@ -1,4 +1,5 @@ {% load static %} +{% load input_field %} @@ -76,7 +77,8 @@ - + {% check_list source=responses.want_which_orders value='A legal end to the marriage' as order_wanted %} + @@ -291,7 +293,8 @@
Claimant 1 and Claimant 2 are asking for a divorce order. {% else %} icon-check-empty"> {% endif %} Claimant 1 and Claimant 2 are asking for a divorce order.
A Personal information:
- - + {% check_list source=responses.want_which_orders value='Division of property and debts' as order_wanted %} + @@ -345,7 +349,8 @@
{% else %} fa-square-o" aria-hidden="true"> {% endif %} Claimant 1 and Claimant 2 are asking for an order for spousal support as follows: + {% check_list source=responses.want_which_orders value='Spousal support' as order_wanted %} + {% else %} icon-check-empty"> {% endif %} Claimant 1 and Claimant 2 are asking for an order for spousal support as follows: {% if responses.spouse_support_details %} {{responses.spouse_support_details }} {% else %}   {% endif %}

[set out terms of proposed order] @@ -317,7 +320,8 @@

A Property claims under the Family Law Act
Claimant 1 and Claimant 2 are asking for an order for:
[Check whichever one of the following boxes is correct and complete any required information in relation to family property and family debt, as those terms are defined in the Family Law Act.]
{% else %} icon-check-empty"> {% endif %} Claimant 1 and Claimant 2 are asking for an order for:
[Check whichever one of the following boxes is correct and complete any required information in relation to family property and family debt, as those terms are defined in the Family Law Act.]
{% else %} fa-square-o" aria-hidden="true"> {% endif %} an equal division of family property and family debt
-
Claimant 1 and Claimant 2 are asking for an order in the following terms:   + {% check_list source=responses.want_which_orders value='Other orders' as order_wanted %} + {% else %} icon-check-empty"> {% endif %} Claimant 1 and Claimant 2 are asking for an order in the following terms:  

[set out terms of proposed order]

diff --git a/edivorce/apps/core/templatetags/input_field.py b/edivorce/apps/core/templatetags/input_field.py index 6f1d0f45..e6cfb581 100644 --- a/edivorce/apps/core/templatetags/input_field.py +++ b/edivorce/apps/core/templatetags/input_field.py @@ -43,3 +43,11 @@ def additional_attributes(tag, **kwargs): key = str.replace(key, 'data_', 'data-') tag.append(' ' + key + '="' + data_val + '"') return tag + + +@register.assignment_tag +def check_list(source, value): + """ + Check if given value is in the given source + """ + return value in source.split('; ')