Browse Source

DIV-724: formatting children into review table

pull/160/head
Benard Ebinu 8 years ago
parent
commit
bc28748eef
3 changed files with 30 additions and 1 deletions
  1. +2
    -0
      edivorce/apps/core/templates/partials/review_user_responses.html
  2. +1
    -1
      edivorce/apps/core/templates/question/13_review.html
  3. +27
    -0
      edivorce/apps/core/templatetags/summary_format.py

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

@ -18,6 +18,8 @@
{% marriage_tag source=questions %} {% marriage_tag source=questions %}
{% elif step == 'other_questions' %} {% elif step == 'other_questions' %}
{% combine_address source=questions %} {% combine_address source=questions %}
{% elif step == 'your_children' %}
{% format_children source=questions %}
{% else %} {% else %}
{% for question in questions %} {% for question in questions %}
<tr> <tr>


+ 1
- 1
edivorce/apps/core/templates/question/13_review.html View File

@ -117,7 +117,7 @@
<div class="clearfix"> </div> <div class="clearfix"> </div>
<div class="collapse in" id="review_step_6"> <div class="collapse in" id="review_step_6">
<div> <div>
{% include "partials/review_user_responses.html" with questions=your_children %}
{% include "partials/review_user_responses.html" with questions=your_children step='your_children' %}
</div> </div>
</div> </div>
</div> </div>


+ 27
- 0
edivorce/apps/core/templatetags/summary_format.py View File

@ -43,6 +43,33 @@ def process_list(lst, question_key):
return ''.join(tag) return ''.join(tag)
def format_row(question, response):
return '<tr><td width="75%" style="padding-right: 5%">{0}</td><td width="25%">{1}</td></tr>'.format(
question, response
)
@register.simple_tag
def format_children(source):
"""
:param source:
:return:
"""
tags = []
for item in source:
q_id = item['question_id']
if q_id == 'claimant_children':
tags.append(format_row('<strong>{}</strong>'.format(item['question__name']), ''))
for child in json.loads(item['value']):
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 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']))
return ''.join(tags)
@register.simple_tag @register.simple_tag
def combine_address(source): def combine_address(source):
""" """


Loading…
Cancel
Save