From f4db36d2ec58f821478e1cd33cc3c5d0f78c7908 Mon Sep 17 00:00:00 2001 From: Benard Ebinu Date: Mon, 15 Jan 2018 10:39:43 -0800 Subject: [PATCH] DIV-714: Insert the name of the payor into fact sheet B --- .../templates/question/06_children_facts.html | 3 ++- edivorce/apps/core/templatetags/format_utils.py | 17 +++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/edivorce/apps/core/templates/question/06_children_facts.html b/edivorce/apps/core/templates/question/06_children_facts.html index 75868bb0..886d26f4 100644 --- a/edivorce/apps/core/templates/question/06_children_facts.html +++ b/edivorce/apps/core/templates/question/06_children_facts.html @@ -1,6 +1,7 @@ {% extends 'base.html' %} {% load input_field %} {% load step_order %} +{% load format_utils %} {% block title %}{{ block.super }}: Your Children {% endblock %} @@ -420,7 +421,7 @@ - Amount of child support to be paid per month by {% if child_support_payor %}{{ child_support_payor|lower }}{% else %}the payor{% endif %} + Amount of child support to be paid per month by {% payorize %}
diff --git a/edivorce/apps/core/templatetags/format_utils.py b/edivorce/apps/core/templatetags/format_utils.py index a9eabd8f..fd134093 100644 --- a/edivorce/apps/core/templatetags/format_utils.py +++ b/edivorce/apps/core/templatetags/format_utils.py @@ -120,3 +120,20 @@ def money(amount, symbol=True): pass return '' + + +@register.simple_tag(takes_context=True) +def payorize(context): + payor = 'the payor' + child_support_payor = context.get('child_support_payor', None) + if child_support_payor == 'Myself (Claimant 1)': + payor = context.get('name_you', child_support_payor) + elif child_support_payor == 'My Spouse (Claimant 2)': + payor = context.get('name_spouse', child_support_payor) + elif child_support_payor == 'Both myself and my spouse': + payor = '{} and {}'.format(context.get('name_you', 'myself'), + context.get('name_spouse', 'my spouse')) + return payor + + +