From c7d10af211f0aa6bbab5bc3fbeeec4018e3cd867 Mon Sep 17 00:00:00 2001
From: Justin Johnson
Date: Fri, 20 Oct 2017 14:04:43 -0700
Subject: [PATCH] DIV-501
---
edivorce/apps/core/templates/pdf/form38.html | 7 +++---
.../apps/core/templates/pdf/form38_we.html | 7 +++---
edivorce/apps/core/templates/pdf/form52.html | 13 ++++-------
edivorce/apps/core/templatetags/composites.py | 22 +++++++++++++++++++
4 files changed, 32 insertions(+), 17 deletions(-)
create mode 100644 edivorce/apps/core/templatetags/composites.py
diff --git a/edivorce/apps/core/templates/pdf/form38.html b/edivorce/apps/core/templates/pdf/form38.html
index b91098d4..73239f02 100644
--- a/edivorce/apps/core/templates/pdf/form38.html
+++ b/edivorce/apps/core/templates/pdf/form38.html
@@ -1,4 +1,5 @@
{% load static %}
+{% load composites %}
{% load input_field %}
{% load format_utils %}
@@ -126,8 +127,7 @@
Pursuant to Section 5 of the Name Act, Claimant 1 shall
bear the name of {{ responses.name_change_you_fullname }}
- to take effect on the 31st day after the date of this
- order.
+ to take effect on {% effective_date %}.
{% endif %}
@@ -135,8 +135,7 @@
Pursuant to Section 5 of the Name Act, Claimant 2 shall
bear the name of {{ responses.name_change_spouse_fullname }}
- to take effect on the 31st day after the date of this
- order.
+ to take effect on {% effective_date %}.
{% endif %}
diff --git a/edivorce/apps/core/templates/pdf/form38_we.html b/edivorce/apps/core/templates/pdf/form38_we.html
index 50916983..0ac517c0 100644
--- a/edivorce/apps/core/templates/pdf/form38_we.html
+++ b/edivorce/apps/core/templates/pdf/form38_we.html
@@ -1,4 +1,5 @@
{% load static %}
+{% load composites %}
{% load input_field %}
{% load format_utils %}
@@ -118,8 +119,7 @@
Pursuant to Section 5 of the Name Act, Claimant 1 shall
bear the name of {{ responses.name_change_you_fullname }}
- to take effect on the 31st day after the date of this
- order.
+ to take effect on {% effective_date %}.
{% endif %}
@@ -127,8 +127,7 @@
Pursuant to Section 5 of the Name Act, Claimant 2 shall
bear the name of {{ responses.name_change_spouse_fullname }}
- to take effect on the 31st day after the date of this
- order.
+ to take effect on {% effective_date %}.
{% endif %}
diff --git a/edivorce/apps/core/templates/pdf/form52.html b/edivorce/apps/core/templates/pdf/form52.html
index 94d67f1f..860cb1ab 100644
--- a/edivorce/apps/core/templates/pdf/form52.html
+++ b/edivorce/apps/core/templates/pdf/form52.html
@@ -1,4 +1,5 @@
{% load static %}
+{% load composites %}
{% load input_field %}
{% load format_utils %}
{% load load_json %}
@@ -99,11 +100,7 @@
{% endif %}
{% else %}{% endif %}
on {% if responses.when_were_you_married %} {{ responses.when_were_you_married|date_formatter }} {% else %}{% endif %}, are divorced from each other,
- {% if responses.divorce_take_effect_on == 'the 31st day after the date of this order' %}
- the divorce to take effect on the 31st day after the date of this order.
- {% else %}
- the divorce to take effect on {% if responses.divorce_take_effect_on_specific_date %}{{ responses.divorce_take_effect_on_specific_date|date_formatter }}{% else %}{% endif %}.
- {% endif %}
+ the divorce to take effect on {% effective_date %}.
{% endif %}
@@ -135,8 +132,7 @@
Pursuant to Section 5 of the Name Act, Claimant 1 shall
bear the name of {{ responses.name_change_you_fullname }}
- to take effect on the 31st day after the date of this
- order.
+ to take effect on {% effective_date %}.
{% endif %}
@@ -144,8 +140,7 @@
Pursuant to Section 5 of the Name Act, Claimant 2 shall
bear the name of {{ responses.name_change_spouse_fullname }}
- to take effect on the 31st day after the date of this
- order.
+ to take effect on {% effective_date %}.
{% endif %}
diff --git a/edivorce/apps/core/templatetags/composites.py b/edivorce/apps/core/templatetags/composites.py
new file mode 100644
index 00000000..eb3f31a7
--- /dev/null
+++ b/edivorce/apps/core/templatetags/composites.py
@@ -0,0 +1,22 @@
+import sys
+
+from django import template
+
+from .format_utils import date_formatter
+
+register = template.Library()
+
+
+@register.simple_tag(takes_context=True)
+def effective_date(context, *args, **kwargs):
+ """ Returns the effective date of the divorce, based on user's answers """
+
+ effective = 'the 31st day after the date of this order'
+ if context['responses']['divorce_take_effect_on'] == 'specific date':
+ date = context['responses']['divorce_take_effect_on_specific_date']
+ if date == '':
+ effective = ''
+ else:
+ effective = date_formatter(date)
+ return effective
+