Browse Source

DIV-889: Update to 1.9

pull/160/head
Charles Shin 7 years ago
parent
commit
b1b13b2ca7
5 changed files with 178 additions and 161 deletions
  1. +0
    -2
      edivorce/apps/core/templates/partials/review_user_responses.html
  2. +2
    -1
      edivorce/apps/core/templatetags/composites.py
  3. +2
    -1
      edivorce/apps/core/templatetags/format_utils.py
  4. +41
    -26
      edivorce/apps/core/templatetags/input_field.py
  5. +133
    -131
      edivorce/apps/core/templatetags/summary_format.py

+ 0
- 2
edivorce/apps/core/templates/partials/review_user_responses.html View File

@ -1,6 +1,5 @@
{% load summary_format %}
{% if questions %}
{% if step == 'your_children' %}
<table class="table table-striped">
<thead>
@ -11,7 +10,6 @@
</thead>
{% format_children source=questions %}
</table>
{% else %}
<table class="table table-bordered table-striped">
<thead>


+ 2
- 1
edivorce/apps/core/templatetags/composites.py View File

@ -5,6 +5,7 @@ users full responses.
from django import template
from .format_utils import date_formatter
from django.utils.html import format_html
register = template.Library()
@ -17,7 +18,7 @@ def effective_date(context):
if context['responses'].get('divorce_take_effect_on', '') == 'specific date':
date = context['responses'].get('divorce_take_effect_on_specific_date', '')
if date == '':
effective = '<span class="form-entry not-complete"></span>'
effective = format_html('<span class="form-entry not-complete"></span>')
else:
effective = date_formatter(date)
return effective

+ 2
- 1
edivorce/apps/core/templatetags/format_utils.py View File

@ -6,6 +6,7 @@ import locale
import re
from django import template
from django.utils.html import format_html
from django.utils.safestring import mark_safe
from django.utils.timesince import timesince
@ -48,7 +49,7 @@ def response(field, size=None, trail='', as_date=False):
if field.strip():
return '%s%s' % (date_formatter(field) if as_date else field, trail)
style = ('min-width: %spx' % size) if size is not None else ''
return '<span class="form-entry not-complete" style="%s"></span>' % style
return format_html('<span class="form-entry not-complete" style="{}"></span>', style)
@register.simple_tag()


+ 41
- 26
edivorce/apps/core/templatetags/input_field.py View File

@ -2,6 +2,7 @@ from datetime import datetime
import json
from django import template
from django.utils.html import format_html
from ..models import UserResponse
@ -36,14 +37,25 @@ def money_input_field(context, input_type='number', name='', value_src=None, val
if kwargs.get('step', None):
step = kwargs.get('step')
tag = ['<input type="{}" value="{:.2f}" step="{}" min="0" '.format(input_type, float(value), step)]
tag = format_html(
'<input type="{}" value="{}" step="{}" min="0"',
input_type,
"{:.2f}".format(float(value)),
step)
if name != '':
tag.append('name="{}"'.format(name))
tag = format_html(
'{} name="{}"',
tag,
name)
tag = additional_attributes(tag, **kwargs)
tag.append('>')
return ''.join(tag)
attributes = additional_attributes(**kwargs)
tag = format_html(
'{}{} />',
tag,
attributes)
return tag
@register.simple_tag(takes_context=True)
@ -52,18 +64,14 @@ def input_field(context, type, name='', value='', multiple='', **kwargs):
Usage: when specifying data attributes in templates, use "data_" instead of "data-".
"""
if type == "textarea":
tag = ['<textarea name="' + name + '"']
tag = additional_attributes(tag, **kwargs)
tag.append('>')
attributes = additional_attributes(**kwargs)
if value == '':
tag.append(context.get(name, ''))
else:
tag.append(value)
tag.append('</textarea>')
value = context.get(name, '')
tag = format_html(
'<textarea name="{}"{}>{}</textarea>',
name,
attributes,
value)
else:
# set initial value for textbox
if type == "text":
@ -83,33 +91,40 @@ def input_field(context, type, name='', value='', multiple='', **kwargs):
pass # conversion to current format not needed
elif type == "number":
value = context.get(name, '')
tag = ['<input type="%s" name="%s" value="%s"' % (type, name, value)]
tag = additional_attributes(tag, **kwargs)
attributes = additional_attributes(**kwargs)
# check if buttons should be selected by default
checked = ''
if type == 'checkbox':
value_list = json.loads(context.get(name, '[]'))
else:
value_list = context.get(name, '')
if value_list is not None and value != '' and value in value_list:
tag.append(' checked')
checked = 'checked'
tag.append('>')
tag = format_html(
'<input type="{}" name="{}" value="{}"{} {}/>',
type,
name,
value,
attributes,
checked)
return ''.join(tag)
return tag
def additional_attributes(tag, **kwargs):
def additional_attributes(**kwargs):
attributes = ''
for key, data_val in kwargs.items():
if str.startswith(key, 'data_'):
key = str.replace(key, 'data_', 'data-')
tag.append(' ' + key + '="' + data_val + '"')
return tag
attributes = format_html('{} {}="{}"', attributes, key, data_val)
return attributes
@register.assignment_tag
@register.simple_tag
def check_list(source, value):
"""
Check if given value is in the given source
@ -120,7 +135,7 @@ def check_list(source, value):
return False
@register.assignment_tag
@register.simple_tag
def multiple_values_to_list(source):
try:
return json.loads(source)


+ 133
- 131
edivorce/apps/core/templatetags/summary_format.py View File

@ -4,6 +4,7 @@ from django import template
import json
from django.core.urlresolvers import reverse
from django.utils.html import format_html, format_html_join
register = template.Library()
@ -28,67 +29,81 @@ def reformat_value(source, question_key):
def process_list(lst, question_key):
tag = ["<ul>"]
if question_key.startswith('other_name_'):
for alias_type, value in lst:
if value:
tag.append('<li>' + alias_type + ' ' + value + '</li>')
list_items = format_html_join(
'\n',
'<li>{} {}</li>',
((alias_type, value) for alias_type, value in lst if value))
else:
for value in lst:
if value and not value.isspace():
tag.append('<li>' + str(value) + '</li>')
tag.append('</ul>')
return ''.join(tag)
list_items = format_html_join(
'\n',
'<li>{0}</li>',
((value, '') for value in lst if value and not value.isspace()))
tag = format_html(
'<ul>{}</ul>',
list_items)
return tag
def reformat_list(source):
text_list = source.split('\n')
if len(text_list) > 1:
tag = ["<ul>"]
for value in text_list:
if value and not value.isspace():
tag.append('<li>' + value + '</li>')
tag.append('</ul>')
return ''.join(tag)
list_items = format_html_join(
'\n',
'<li>{0}</li>',
((value, '') for value in text_list if value))
tag = format_html(
'<ul>{}</ul>',
list_items)
return tag
else:
return text_list.pop()
def format_row(question, response):
return '<tr><td width="75%" class="table-bordered" style="padding-right: 5%">{0}</td><td class="table-bordered" width="25%">{1}</td></tr>'.format(
question, response
)
return format_html(
'<tr><td width="75%" class="table-bordered" style="padding-right: 5%">{0}</td><td class="table-bordered" width="25%">{1}</td></tr>',
question,
response)
def format_review_row_heading(title, style=""):
return '<tr><td colspan="2" class="table-bordered {1}"><b>{0}</b></td></tr>'.format(title, style)
return format_html(
'<tr><td colspan="2" class="table-bordered {1}"><b>{0}</b></td></tr>',
title,
style)
def format_head(headings):
if len(headings) == 0:
return '', []
# def format_head(headings):
# if len(headings) == 0:
# return '', []
tags = ["<tr>"]
head_order = list()
for key in headings[0].keys():
tags.append('<th>{}</th>'.format(key.replace('_', ' ').title()))
head_order.append(key)
tags.append('</tr>')
return ''.join(tags), head_order
# tags = ["<tr>"]
# head_order = list()
# for key in headings[0].keys():
# tags.append('<th>{}</th>'.format(key.replace('_', ' ').title()))
# head_order.append(key)
# tags.append('</tr>')
# return ''.join(tags), head_order
def process_fact_sheet_list(data, header):
tags = list()
for item in data:
tags.append('<tr>')
for key in header:
tags.append('<td>{}</td>'.format(item.get(key, '')))
tags.append('</tr>')
return ''.join(tags)
# def process_fact_sheet_list(data, header):
# tags = list()
# for item in data:
# tags.append('<tr>')
# for key in header:
# tags.append('<td>{}</td>'.format(item.get(key, '')))
# tags.append('</tr>')
# return ''.join(tags)
def format_fact_sheet(title, url, style=''):
return '<tr><td colspan="2" class="table-bordered {0}"><a href="{1}"><b>{2}</b></a></td></tr>'.format(style, url, title)
return format_html(
'<tr><td colspan="2" class="table-bordered {0}"><a href="{1}"><b>{2}</b></a></td></tr>',
style,
url,
title)
@register.simple_tag(takes_context=True)
@ -152,12 +167,11 @@ def format_children(context, source):
child_support_orders = {'have_court_order', 'what_parenting_arrangements', 'order_respecting_arrangement', 'order_for_child_support'}
tags = []
tags = '<tbody>'
# process mapped questions first
working_source = source.copy()
tags.append('<tbody>')
for title, questions in question_to_heading.items():
tags.append(format_review_row_heading(title))
tags = format_html('{}{}', tags, format_review_row_heading(title))
for question in questions:
if question in fact_sheet_mapping:
@ -177,7 +191,7 @@ def format_children(context, source):
show_fact_sheet = True
if show_fact_sheet and len(fact_sheet_mapping[question]):
tags.append(format_fact_sheet(question, fact_sheet_mapping[question]))
tags = format_html('{}{}', tags, format_fact_sheet(question, fact_sheet_mapping[question]))
else:
item = list(filter(lambda x: x['question_id'] == question, working_source))
@ -187,7 +201,7 @@ def format_children(context, source):
item = item.pop()
if context['derived']['wants_child_support'] is True:
# make sure free form text is reformted to be bullet list.
tags.append(format_row(item['question__name'], reformat_list(item['value'])))
tags = format_html('{}{}{}', tags, format_row(item['question__name'], reformat_list(item['value'])))
continue
if len(item):
@ -197,12 +211,14 @@ def format_children(context, source):
if q_id == 'claimant_children':
child_counter = 1
for child in json.loads(item['value']):
tags.append(format_review_row_heading('Child {}'.format(child_counter), 'review-child-heading'))
tags.append(format_row('Child\'s name', child['child_name']))
tags.append(format_row('Birth date', child['child_birth_date']))
tags.append(format_row('Child now living with', child['child_live_with']))
tags.append(format_row('Relationship to yourself (claimant 1)', child['child_relationship_to_you']))
tags.append(format_row('Relationship to your spouse (claimant 2)', child['child_relationship_to_spouse']))
tags = format_html(
'{}{}{}{}{}{}',
format_review_row_heading('Child {}'.format(child_counter), 'review-child-heading'),
format_row('Child\'s name', child['child_name']),
format_row('Birth date', child['child_birth_date']),
format_row('Child now living with', child['child_live_with']),
format_row('Relationship to yourself (claimant 1)', child['child_relationship_to_you']),
format_row('Relationship to your spouse (claimant 2)', child['child_relationship_to_spouse']))
child_counter = child_counter + 1
else:
value = item['value']
@ -220,16 +236,15 @@ def format_children(context, source):
value = reformat_list(value)
if isinstance(value, list):
tags.append(format_row(question_name, process_list(value, q_id)))
tags = format_html('{}{}', tags, format_row(question_name, process_list(value, q_id)))
elif isinstance(value, str):
if len(value):
tags.append(format_row(question_name, value))
tags = format_html('{}{}', tags, format_row(question_name, value))
else:
tags.append(format_row(question_name, value))
tags.append('</tbody>')
tags.append('<tbody class="review-table-spacer">')
tags.append('</tbody>')
return ''.join(tags)
tags = format_html('{}{}', tags, format_row(question_name, value))
tags = format_html('{}</tbody> <tbody class="review-table-spacer">', tags)
tags = format_html('{}</tbody>', tags)
return tags
@register.simple_tag
@ -238,10 +253,7 @@ def combine_address(source):
Reformat address to combine them into one cell with multiple line
Also show/hide optional questions
"""
tags = []
first_column = '<tr><td width="75%" style="padding-right: 5%">'
second_column = '<td width="25%">'
end_tag = '</td></tr>'
tags = ''
address_you = ""
fax_you = ""
@ -258,7 +270,7 @@ def combine_address(source):
if "email" not in q_id and "fax" not in q_id:
if q_id == "address_to_send_official_document_country_you":
continue
address_you += item["value"] + '<br />'
address_you = format_html('{}{}<br />', address_you, item["value"])
elif "fax" in q_id:
fax_you = item["value"]
elif "email" in q_id:
@ -267,7 +279,7 @@ def combine_address(source):
if "email" not in q_id and "fax" not in q_id:
if q_id == "address_to_send_official_document_country_spouse":
continue
address_spouse += item["value"] + '<br />'
address_spouse = format_html('{}{}<br />', address_spouse, item["value"])
elif "fax" in q_id:
fax_spouse = item["value"]
elif "email" in q_id:
@ -281,27 +293,21 @@ def combine_address(source):
effective_date = item['value']
if address_you != "":
tags.append(first_column + "What is the best address to send you official court documents?</td>"
+ second_column + address_you + end_tag)
tags = format_table_data(tags, "What is the best address to send you official court documents?", address_you)
if fax_you != "":
tags.append(first_column + "Fax</td>" + second_column + fax_you + end_tag)
tags = format_table_data(tags, "Fax", fax_you)
if email_you != "":
tags.append(first_column + "Email</td>" + second_column + email_you + end_tag)
tags = format_table_data(tags, "Email", email_you)
if address_spouse != "":
tags.append(first_column + "What is the best address to send your spouse official court documents?</td>"
+ second_column + address_spouse + end_tag)
tags = format_table_data(tags, "What is the best address to send your spouse official court documents?", address_spouse)
if fax_spouse != "":
tags.append(first_column + "Fax</td>" + second_column + fax_spouse + end_tag)
tags = format_table_data(tags, "Fax", fax_spouse)
if email_spouse != "":
tags.append(first_column + "Email</td>" + second_column + email_spouse + end_tag)
tags = format_table_data(tags, "Email", email_spouse)
if effective_date != "":
tags.append(first_column + "Divorce is to take effect on </td>" + second_column + effective_date + end_tag)
tags = format_table_data(tags, "Divorce is to take effect on", effective_date)
return ''.join(tags)
return tags
@register.simple_tag(takes_context=True)
@ -311,10 +317,7 @@ def marriage_tag(context, source):
Also show/hide optional questions
"""
show_all = False
tags = []
first_column = '<tr><td width="75%" style="padding-right: 5%">'
second_column = '</td><td width="25%">'
end_tag = '</td></tr>'
tags = ''
marriage_location = ""
married_date = ""
@ -348,7 +351,7 @@ def marriage_tag(context, source):
elif q_id.startswith('where_were_you_married'):
if value == 'Other':
continue
marriage_location += value + '<br />'
marriage_location = format_html('{}{}<br />', marriage_location, value)
elif q_id == 'marital_status_before_you':
marital_status_you_q = q_name
marital_status_you = value
@ -357,17 +360,17 @@ def marriage_tag(context, source):
marital_status_spouse = value
if show_all and married_date != "":
tags.append(first_column + married_date_q + second_column + married_date + end_tag)
tags = format_table_data(tags, married_date_q, married_date)
if common_law_date != "":
tags.append(first_column + common_law_date_q + second_column + common_law_date + end_tag)
tags = format_table_data(tags, common_law_date_q, common_law_date)
if show_all and marriage_location != "":
tags.append(first_column + "Where were you married" + second_column + marriage_location + end_tag)
tags = format_table_data(tags, "Where were you married", marriage_location)
if marital_status_you != "":
tags.append(first_column + marital_status_you_q + second_column + marital_status_you + end_tag)
tags = format_table_data(tags, marital_status_you_q, marital_status_you)
if marital_status_spouse != "":
tags.append(first_column + marital_status_spouse_q + second_column + marital_status_spouse + end_tag)
tags = format_table_data(tags, marital_status_spouse_q, marital_status_spouse)
return ''.join(tags)
return tags
@register.simple_tag
@ -376,10 +379,7 @@ def property_tag(source):
Reformat your_property and debt step
Also show/hide optional questions
"""
tags = []
first_column = '<tr><td width="75%" style="padding-right: 5%">'
second_column = '</td><td width="25%">'
end_tag = '</td></tr>'
tags = ''
division = division_detail = other_detail = None
@ -394,13 +394,13 @@ def property_tag(source):
other_detail = item
if division:
tags.append(first_column + division['question__name'] + second_column + division['value'] + end_tag)
tags = format_table_data(tags, division['question__name'], division['value'])
if division and division['value'] == "Unequal division" and division_detail:
tags.append(first_column + division_detail['question__name'] + second_column + process_list(division_detail['value'].split('\n'), division_detail['question_id']) + end_tag)
tags = format_table_data(tags, division_detail['question__name'], process_list(division_detail['value'].split('\n'), division_detail['question_id']))
if other_detail and other_detail['value'].strip():
tags.append(first_column + other_detail['question__name'] + second_column + process_list(other_detail['value'].split('\n'), other_detail['question_id']) + end_tag)
tags = format_table_data(tags, other_detail['question__name'], process_list(other_detail['value'].split('\n'), other_detail['question_id']))
return ''.join(tags)
return tags
@register.simple_tag
@ -409,10 +409,7 @@ def prequal_tag(source):
Reformat prequalification step
Also show/hide optional questions
"""
tags = []
first_column = '<tr><td width="75%" style="padding-right: 5%">'
second_column = '</td><td width="25%">'
end_tag = '</td></tr>'
tags = ''
marriage_status = lived_in_bc = live_at_least_year = separation_date = try_reconcile = reconciliation_period = None
children_of_marriage = number_children_under_19 = number_children_over_19 = financial_support = certificate = provide_later = None
@ -456,39 +453,39 @@ def prequal_tag(source):
divorce_reason['value'] = 'Lived apart for one year'
if marriage_status:
tags.append(first_column + marriage_status['question__name'] + second_column + marriage_status['value'] + end_tag)
tags = format_table_data(tags, marriage_status['question__name'], marriage_status['value'])
if lived_in_bc:
tags.append(first_column + lived_in_bc['question__name'] + second_column + lived_in_bc['value'] + end_tag)
tags = format_table_data(tags, lived_in_bc['question__name'], lived_in_bc['value'])
if live_at_least_year:
tags.append(first_column + live_at_least_year['question__name'] + second_column + live_at_least_year['value'] + end_tag)
tags = format_table_data(tags, live_at_least_year['question__name'], live_at_least_year['value'])
if separation_date:
tags.append(first_column + separation_date['question__name'] + second_column + separation_date['value'] + end_tag)
tags = format_table_data(tags, separation_date['question__name'], separation_date['value'])
if try_reconcile:
tags.append(first_column + try_reconcile['question__name'] + second_column + try_reconcile['value'] + end_tag)
tags = format_table_data(tags, try_reconcile['question__name'], try_reconcile['value'])
if try_reconcile and try_reconcile['value'] == 'YES' and reconciliation_period:
tags.append(first_column + reconciliation_period['question__name'] + second_column + reconciliation_period_reformat(reconciliation_period['value']) + end_tag)
tags = format_table_data(tags, reconciliation_period['question__name'], reconciliation_period_reformat(reconciliation_period['value']))
if children_of_marriage:
tags.append(first_column + children_of_marriage['question__name'] + second_column + children_of_marriage['value'] + end_tag)
tags = format_table_data(tags, children_of_marriage['question__name'], children_of_marriage['value'])
if children_of_marriage and children_of_marriage['value'] == 'YES' and number_children_under_19:
tags.append(first_column + number_children_under_19['question__name'] + second_column + number_children_under_19['value'] + end_tag)
tags = format_table_data(tags, number_children_under_19['question__name'], number_children_under_19['value'])
if children_of_marriage and children_of_marriage['value'] == 'YES' and number_children_over_19:
tags.append(first_column + number_children_over_19['question__name'] + second_column + number_children_over_19['value'] + end_tag)
tags = format_table_data(tags, number_children_over_19['question__name'], number_children_over_19['value'])
if children_of_marriage and children_of_marriage['value'] == 'YES' and number_children_over_19 and financial_support and financial_support['value']:
tags.append(first_column + financial_support['question__name'] + second_column + '<br>'.join(json.loads(financial_support['value'])) + end_tag)
tags = format_table_data(tags, financial_support['question__name'], '<br>'.join(json.loads(financial_support['value'])))
if certificate:
tags.append(first_column + certificate['question__name'] + second_column + certificate['value'] + end_tag)
tags = format_table_data(tags, certificate['question__name'], certificate['value'])
if certificate and certificate['value'] == 'NO' and provide_later:
tags.append(first_column + provide_later['question__name'] + second_column + provide_later['value'] + end_tag)
tags = format_table_data(tags, provide_later['question__name'], provide_later['value'])
if certificate and provide_later and certificate['value'] == 'NO' and provide_later['value'] == 'YES' and provide_later_reason:
tags.append(first_column + provide_later_reason['question__name'] + second_column + process_list(provide_later_reason['value'].split('\n'), provide_later_reason['question_id']) + end_tag)
tags = format_table_data(tags, provide_later_reason['question__name'], process_list(provide_later_reason['value'].split('\n'), provide_later_reason['question_id']))
if certificate and provide_later and certificate['value'] == 'NO' and provide_later['value'] == 'NO' and not_provide_later_reason:
tags.append(first_column + not_provide_later_reason['question__name'] + second_column + process_list(not_provide_later_reason['value'].split('\n'), not_provide_later_reason['question_id']) + end_tag)
tags = format_table_data(tags, not_provide_later_reason['question__name'], process_list(not_provide_later_reason['value'].split('\n'), not_provide_later_reason['question_id']))
if marriage_status and marriage_status['value'] == 'Living together in a marriage like relationship' and in_english:
tags.append(first_column + in_english['question__name'] + second_column + in_english['value'] + end_tag)
tags = format_table_data(tags, in_english['question__name'], in_english['value'])
if divorce_reason:
tags.append(first_column + divorce_reason['question__name'] + second_column + divorce_reason['value'] + end_tag)
tags = format_table_data(tags, divorce_reason['question__name'], divorce_reason['value'])
return ''.join(tags)
return tags
@register.simple_tag
@ -497,10 +494,7 @@ def personal_info_tag(source):
Reformat your information and your spouse step
Also show/hide optional questions
"""
tags = []
first_column = '<tr><td width="75%" style="padding-right: 5%">'
second_column = '</td><td width="25%">'
end_tag = '</td></tr>'
tags = ''
name = other_name = other_name_list = last_name_born = last_name_before = None
birthday = occupation = lived_bc = moved_bc = None
@ -528,25 +522,33 @@ def personal_info_tag(source):
moved_bc = item
if name:
tags.append(first_column + name['question__name'] + second_column + name['value'] + end_tag)
tags = format_table_data(tags, name['question__name'], name['value'])
if other_name:
tags.append(first_column + other_name['question__name'] + second_column + other_name['value'] + end_tag)
tags = format_table_data(tags, other_name['question__name'], other_name['value'])
if other_name and other_name['value'] == 'YES' and other_name_list:
tags.append(first_column + other_name_list['question__name'] + second_column + process_list(json.loads(other_name_list['value']), other_name_list['question_id']) + end_tag)
tags = format_table_data(tags, other_name_list['question__name'], process_list(json.loads(other_name_list['value']), other_name_list['question_id']))
if last_name_born:
tags.append(first_column + last_name_born['question__name'] + second_column + last_name_born['value'] + end_tag)
tags = format_table_data(tags, last_name_born['question__name'], last_name_born['value'])
if last_name_before:
tags.append(first_column + last_name_before['question__name'] + second_column + last_name_before['value'] + end_tag)
tags = format_table_data(tags, last_name_before['question__name'], last_name_before['value'])
if birthday:
tags.append(first_column + birthday['question__name'] + second_column + birthday['value'] + end_tag)
tags = format_table_data(tags, birthday['question__name'], birthday['value'])
if occupation:
tags.append(first_column + occupation['question__name'] + second_column + occupation['value'] + end_tag)
tags = format_table_data(tags, occupation['question__name'], occupation['value'])
if lived_bc and moved_bc and lived_bc['value'] == "Moved to B.C. on":
tags.append(first_column + lived_bc['question__name'] + second_column + lived_bc['value'] + ' ' + moved_bc['value'] + end_tag)
tags = format_table_data(tags, lived_bc['question__name'], lived_bc['value'] + ' ' + moved_bc['value'])
if lived_bc and lived_bc['value'] != "Moved to B.C. on" and lived_bc:
tags.append(first_column + lived_bc['question__name'] + second_column + lived_bc['value'] + end_tag)
tags = format_table_data(tags, lived_bc['question__name'], lived_bc['value'])
return tags
return ''.join(tags)
def format_table_data(tags, question, response):
return format_html(
'{}<tr><td width="75%" style="padding-right: 5%">{}</td><td width="25%">{}</td></tr>',
tags,
question,
response)
def reconciliation_period_reformat(lst):
@ -559,5 +561,5 @@ def reconciliation_period_reformat(lst):
lst = []
period = ""
for f_date, t_date in lst:
period += "From " + f_date + " to " + t_date + "<br />"
period = format_html('{}From {} to {}<br />', period, f_date, t_date)
return period

Loading…
Cancel
Save