Browse Source

Merge pull request #20 from bcgov/DIV-889

DIV-889: Updated Django to 1.11.15
pull/160/head
Charles Shin 7 years ago
committed by GitHub
parent
commit
82f6bc3376
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 197 additions and 189 deletions
  1. +1
    -1
      README.md
  2. +0
    -2
      edivorce/apps/core/templates/partials/review_user_responses.html
  3. +2
    -1
      edivorce/apps/core/templatetags/composites.py
  4. +2
    -1
      edivorce/apps/core/templatetags/format_utils.py
  5. +45
    -26
      edivorce/apps/core/templatetags/input_field.py
  6. +1
    -1
      edivorce/apps/core/templatetags/step_order.py
  7. +125
    -137
      edivorce/apps/core/templatetags/summary_format.py
  8. +0
    -3
      edivorce/apps/core/urls.py
  9. +1
    -1
      edivorce/apps/core/utils/step_completeness.py
  10. +2
    -1
      edivorce/apps/core/utils/user_response.py
  11. +5
    -11
      edivorce/apps/core/views/main.py
  12. +1
    -1
      edivorce/apps/core/views/system.py
  13. +2
    -1
      edivorce/settings/base.py
  14. +2
    -0
      edivorce/settings/local.py
  15. +4
    -0
      edivorce/urls.py
  16. +1
    -1
      requirements.txt
  17. +3
    -1
      wsgi.py

+ 1
- 1
README.md View File

@ -40,7 +40,7 @@ To run this project in your development machine, follow these steps:
8. Start the [Weasyprint server](https://hub.docker.com/r/aquavitae/weasyprint/) server on port 5005
1. Bind the IP address 10.200.10.1 to the lo0 interface on your Mac computer. Weasyprint has been configured to use this IP address to request CSS files from Django *(You should only have to do this once)*.
1. Bind the IP address 10.200.10.1 to the lo0 interface on your Mac computer. Weasyprint has been configured to use this IP address to request CSS files from Django.
```
sudo ifconfig lo0 alias 10.200.10.1/24
```


+ 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()


+ 45
- 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,44 @@ 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 +139,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)


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

@ -1,7 +1,7 @@
from django import template
import json
from django.core.urlresolvers import reverse
from django.urls import reverse
from ..utils.template_step_order import template_step_order, template_sub_step_order, get_step_name, \
get_step_or_sub_step_name


+ 125
- 137
edivorce/apps/core/templatetags/summary_format.py View File

@ -3,7 +3,8 @@ from collections import OrderedDict
from django import template
import json
from django.core.urlresolvers import reverse
from django.urls import reverse
from django.utils.html import format_html, format_html_join
register = template.Library()
@ -28,67 +29,58 @@ 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)
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
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)
return format_html(
'<tr><td colspan="2" class="table-bordered {1}"><b>{0}</b></td></tr>',
title,
style)
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 +144,14 @@ 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 +171,10 @@ 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 +184,10 @@ 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 +197,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 +222,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 +239,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 +256,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 +265,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 +279,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 +303,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 +337,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 +346,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 +365,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 +380,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 +395,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 +439,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 +480,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 +508,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 +547,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

+ 0
- 3
edivorce/apps/core/urls.py View File

@ -2,9 +2,6 @@ from django.conf.urls import url
from .views import main, system, pdf, api, localdev
handler404 = 'core.views.main.page_not_found'
handler500 = 'core.views.main.server_error'
urlpatterns = [
# url(r'^guide$', styleguide.guide),
url(r'^api/response$', api.UserResponseHandler.as_view()),


+ 1
- 1
edivorce/apps/core/utils/step_completeness.py View File

@ -1,4 +1,4 @@
from django.core.urlresolvers import reverse
from django.urls import reverse
from edivorce.apps.core.models import Question
from edivorce.apps.core.utils.question_step_mapping import question_step_mapping, pre_qual_step_question_mapping


+ 2
- 1
edivorce/apps/core/utils/user_response.py View File

@ -1,6 +1,7 @@
from edivorce.apps.core.models import UserResponse, Question
from edivorce.apps.core.utils.question_step_mapping import question_step_mapping
from edivorce.apps.core.utils.step_completeness import evaluate_numeric_condition
from collections import OrderedDict
def get_responses_from_db(bceid_user):
@ -85,7 +86,7 @@ def get_responses_from_db_grouped_by_steps(bceid_user, hide_failed_conditionals=
def get_responses_from_session(request):
return sorted(request.session.items())
return OrderedDict(sorted(request.session.items()))
def get_responses_from_session_grouped_by_steps(request):


+ 5
- 11
edivorce/apps/core/views/main.py View File

@ -1,7 +1,7 @@
import datetime
from django.conf import settings
from django.shortcuts import render, redirect, render_to_response
from django.shortcuts import render, redirect
from django.utils import timezone
from django.template import RequestContext
@ -72,8 +72,8 @@ def incomplete(request):
missed_questions = get_formatted_incomplete_list(missed_question_keys)
responses_dict = get_responses_from_session(request)
responses_dict.append(('debug', settings.DEBUG, ))
responses_dict.append(('missed_questions', missed_questions, ))
responses_dict['debug'] = settings.DEBUG
responses_dict['missed_questions'] = missed_questions
return render(request, 'incomplete.html', context=responses_dict)
@ -204,20 +204,14 @@ def page_not_found(request):
"""
404 Error Page
"""
response = render_to_response('404.html', {},
context_instance=RequestContext(request))
response.status_code = 404
return response
return render(request, '404.html', status=404)
def server_error(request):
"""
500 Error Page
"""
response = render_to_response('500.html', {},
context_instance=RequestContext(request))
response.status_code = 500
return response
return render(request, '500.html', status=500)
def legal(request):


+ 1
- 1
edivorce/apps/core/views/system.py View File

@ -1,7 +1,7 @@
from django.conf import settings
from django.http import HttpResponse, Http404
from django.shortcuts import render, redirect
from django.core.urlresolvers import reverse
from django.urls import reverse
from edivorce.apps.core.models import Question


+ 2
- 1
edivorce/settings/base.py View File

@ -56,7 +56,6 @@ MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'edivorce.apps.core.middleware.bceid_middleware.BceidMiddleware',
@ -144,3 +143,5 @@ DEBUG_TOOLBAR_CONFIG = {
}
SECURE_BROWSER_XSS_FILTER = True
LOGOUT_URL = '/accounts/logout/'

+ 2
- 0
edivorce/settings/local.py View File

@ -25,3 +25,5 @@ PROXY_BASE_URL = ''
SASS_PROCESSOR_ENABLED = True
SASS_PROCESSOR_ROOT = PROJECT_ROOT + '/edivorce/apps/core/static'
SASS_OUTPUT_STYLE = 'compressed'
LOGOUT_URL = '/accounts/logout/'

+ 4
- 0
edivorce/urls.py View File

@ -1,6 +1,7 @@
from django.conf import settings
from django.conf.urls import include, url
from django.contrib import admin
from .apps.core.views import main
urlpatterns = []
@ -12,3 +13,6 @@ if settings.ENVIRONMENT in ['localdev', 'minishift']:
urlpatterns.append(url(r'^admin/', admin.site.urls))
urlpatterns.append(url(r'^', include('edivorce.apps.core.urls')))
handler404 = main.page_not_found
handler500 = main.server_error

+ 1
- 1
requirements.txt View File

@ -1,4 +1,4 @@
Django<1.9
Django<1.12
django-compressor==2.1
django-crispy-forms==1.6.1
django-debug-toolbar==1.9


+ 3
- 1
wsgi.py View File

@ -15,6 +15,7 @@ from django.core.management import execute_from_command_line
# check if the app is running on OpenShift
if not os.environ.get('OPENSHIFT_BUILD_NAMESPACE', False):
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "edivorce.settings.local")
is_local = True
else:
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "edivorce.settings.openshift")
@ -32,6 +33,7 @@ if platform_name == "Windows":
question_fixture_path = os.path.realpath("./edivorce/fixtures/Question.json")
# load the Question fixture
execute_from_command_line(['manage.py', 'loaddata', question_fixture_path])
if not is_local:
execute_from_command_line(['manage.py', 'loaddata', question_fixture_path])
application = get_wsgi_application()

Loading…
Cancel
Save