From 045d0326714ff8a4a5c27e5746970b45ec44af66 Mon Sep 17 00:00:00 2001 From: Henry Doupe Date: Mon, 26 Feb 2018 20:33:49 -0500 Subject: [PATCH] Really old runs (pre TC 0.6) didn't have start years --- webapp/apps/taxbrain/forms.py | 5 ++++- webapp/apps/taxbrain/views.py | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/webapp/apps/taxbrain/forms.py b/webapp/apps/taxbrain/forms.py index 53b98a37..12e7858e 100644 --- a/webapp/apps/taxbrain/forms.py +++ b/webapp/apps/taxbrain/forms.py @@ -6,6 +6,8 @@ import six import json +from ..constants import START_YEAR + from .models import TaxSaveInputs from .helpers import (TaxCalcField, TaxCalcParam, default_policy, is_number, int_to_nth, is_string, string_to_float_array, check_wildcards, @@ -164,7 +166,8 @@ def __init__(self, first_year, *args, **kwargs): k ) self._meta.widgets[k].attrs["placeholder"] = django_val - + if first_year is None: + first_year = START_YEAR self._first_year = int(first_year) self._default_params = default_policy(self._first_year) diff --git a/webapp/apps/taxbrain/views.py b/webapp/apps/taxbrain/views.py index 516984f8..933a5f0a 100644 --- a/webapp/apps/taxbrain/views.py +++ b/webapp/apps/taxbrain/views.py @@ -577,11 +577,11 @@ def edit_personal_results(request, pk): init_context = { 'form': form_personal_exemp, - 'params': nested_form_parameters(int(start_year)), + 'params': nested_form_parameters(int(form_personal_exemp._first_year)), 'taxcalc_version': taxcalc_vers_disp, 'webapp_version': webapp_vers_disp, 'start_years': START_YEARS, - 'start_year': str(start_year), + 'start_year': str(form_personal_exemp._first_year), 'is_edit_page': True, 'has_errors': False }