Browse Source

DIV-889: Update to 1.11

pull/160/head
Charles Shin 7 years ago
parent
commit
f25b593684
5 changed files with 22 additions and 31 deletions
  1. +5
    -1
      edivorce/apps/core/templatetags/input_field.py
  2. +12
    -26
      edivorce/apps/core/templatetags/summary_format.py
  3. +2
    -1
      edivorce/apps/core/utils/user_response.py
  4. +2
    -2
      edivorce/apps/core/views/main.py
  5. +1
    -1
      requirements.txt

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

@ -120,7 +120,11 @@ def additional_attributes(**kwargs):
for key, data_val in kwargs.items(): for key, data_val in kwargs.items():
if str.startswith(key, 'data_'): if str.startswith(key, 'data_'):
key = str.replace(key, 'data_', 'data-') key = str.replace(key, 'data_', 'data-')
attributes = format_html('{} {}="{}"', attributes, key, data_val)
attributes = format_html(
'{} {}="{}"',
attributes,
key,
data_val)
return attributes return attributes


+ 12
- 26
edivorce/apps/core/templatetags/summary_format.py View File

@ -75,29 +75,6 @@ def format_review_row_heading(title, style=""):
style) 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)
def format_fact_sheet(title, url, style=''): def format_fact_sheet(title, url, style=''):
return format_html( return format_html(
'<tr><td colspan="2" class="table-bordered {0}"><a href="{1}"><b>{2}</b></a></td></tr>', '<tr><td colspan="2" class="table-bordered {0}"><a href="{1}"><b>{2}</b></a></td></tr>',
@ -171,7 +148,10 @@ def format_children(context, source):
# process mapped questions first # process mapped questions first
working_source = source.copy() working_source = source.copy()
for title, questions in question_to_heading.items(): for title, questions in question_to_heading.items():
tags = format_html('{}{}', tags, format_review_row_heading(title))
tags = format_html(
'{}{}',
tags,
format_review_row_heading(title))
for question in questions: for question in questions:
if question in fact_sheet_mapping: if question in fact_sheet_mapping:
@ -191,7 +171,10 @@ def format_children(context, source):
show_fact_sheet = True show_fact_sheet = True
if show_fact_sheet and len(fact_sheet_mapping[question]): if show_fact_sheet and len(fact_sheet_mapping[question]):
tags = format_html('{}{}', tags, format_fact_sheet(question, fact_sheet_mapping[question]))
tags = format_html(
'{}{}',
tags,
format_fact_sheet(question, fact_sheet_mapping[question]))
else: else:
item = list(filter(lambda x: x['question_id'] == question, working_source)) item = list(filter(lambda x: x['question_id'] == question, working_source))
@ -201,7 +184,10 @@ def format_children(context, source):
item = item.pop() item = item.pop()
if context['derived']['wants_child_support'] is True: if context['derived']['wants_child_support'] is True:
# make sure free form text is reformted to be bullet list. # make sure free form text is reformted to be bullet list.
tags = format_html('{}{}{}', tags, format_row(item['question__name'], reformat_list(item['value'])))
tags = format_html(
'{}{}',
tags,
format_row(item['question__name'], reformat_list(item['value'])))
continue continue
if len(item): if len(item):


+ 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.models import UserResponse, Question
from edivorce.apps.core.utils.question_step_mapping import question_step_mapping from edivorce.apps.core.utils.question_step_mapping import question_step_mapping
from edivorce.apps.core.utils.step_completeness import evaluate_numeric_condition from edivorce.apps.core.utils.step_completeness import evaluate_numeric_condition
from collections import OrderedDict
def get_responses_from_db(bceid_user): 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): 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): def get_responses_from_session_grouped_by_steps(request):


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

@ -72,8 +72,8 @@ def incomplete(request):
missed_questions = get_formatted_incomplete_list(missed_question_keys) missed_questions = get_formatted_incomplete_list(missed_question_keys)
responses_dict = get_responses_from_session(request) 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) return render(request, 'incomplete.html', context=responses_dict)


+ 1
- 1
requirements.txt View File

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


Loading…
Cancel
Save