From f25b59368451f9ec09e758160722c46026728b92 Mon Sep 17 00:00:00 2001 From: Charles Shin Date: Wed, 29 Aug 2018 17:01:54 -0700 Subject: [PATCH] DIV-889: Update to 1.11 --- .../apps/core/templatetags/input_field.py | 6 ++- .../apps/core/templatetags/summary_format.py | 38 ++++++------------- edivorce/apps/core/utils/user_response.py | 3 +- edivorce/apps/core/views/main.py | 4 +- requirements.txt | 2 +- 5 files changed, 22 insertions(+), 31 deletions(-) diff --git a/edivorce/apps/core/templatetags/input_field.py b/edivorce/apps/core/templatetags/input_field.py index 227ef709..d7761e2b 100644 --- a/edivorce/apps/core/templatetags/input_field.py +++ b/edivorce/apps/core/templatetags/input_field.py @@ -120,7 +120,11 @@ def additional_attributes(**kwargs): for key, data_val in kwargs.items(): if str.startswith(key, 'data_'): key = str.replace(key, 'data_', 'data-') - attributes = format_html('{} {}="{}"', attributes, key, data_val) + attributes = format_html( + '{} {}="{}"', + attributes, + key, + data_val) return attributes diff --git a/edivorce/apps/core/templatetags/summary_format.py b/edivorce/apps/core/templatetags/summary_format.py index c5dbdb39..a7476ed8 100644 --- a/edivorce/apps/core/templatetags/summary_format.py +++ b/edivorce/apps/core/templatetags/summary_format.py @@ -75,29 +75,6 @@ def format_review_row_heading(title, style=""): style) -# def format_head(headings): -# if len(headings) == 0: -# return '', [] - -# tags = [""] -# head_order = list() -# for key in headings[0].keys(): -# tags.append('{}'.format(key.replace('_', ' ').title())) -# head_order.append(key) -# tags.append('') -# return ''.join(tags), head_order - - -# def process_fact_sheet_list(data, header): -# tags = list() -# for item in data: -# tags.append('') -# for key in header: -# tags.append('{}'.format(item.get(key, ''))) -# tags.append('') -# return ''.join(tags) - - def format_fact_sheet(title, url, style=''): return format_html( '{2}', @@ -171,7 +148,10 @@ def format_children(context, source): # process mapped questions first working_source = source.copy() 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: if question in fact_sheet_mapping: @@ -191,7 +171,10 @@ def format_children(context, source): show_fact_sheet = True 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: item = list(filter(lambda x: x['question_id'] == question, working_source)) @@ -201,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 = 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 if len(item): diff --git a/edivorce/apps/core/utils/user_response.py b/edivorce/apps/core/utils/user_response.py index fedd0820..884a49f4 100644 --- a/edivorce/apps/core/utils/user_response.py +++ b/edivorce/apps/core/utils/user_response.py @@ -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): diff --git a/edivorce/apps/core/views/main.py b/edivorce/apps/core/views/main.py index 9c1383c4..dc699528 100644 --- a/edivorce/apps/core/views/main.py +++ b/edivorce/apps/core/views/main.py @@ -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) diff --git a/requirements.txt b/requirements.txt index 87298c1c..bf2abfba 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -Django<1.11 +Django<1.12 django-compressor==2.1 django-crispy-forms==1.6.1 django-debug-toolbar==1.9