Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KeyError when choices removed but historic data remains in DB #6

Open
fyaconiello opened this issue Sep 15, 2014 · 0 comments
Open

Comments

@fyaconiello
Copy link

https://github.com/burke-software/django-report-utils/blob/master/report_utils/mixins.py#L361

If for some reason a choice field's choice gets removed, but there is historic data pointing to that choice, this line throws the following error.

File "/home/ubuntu/web/......./venv/local/lib/python2.7/site-packages/report_utils/mixins.py", line 361, in report_to_list
row[position-1] = unicode(choice_list[row[position-1]])
KeyError: u'NY '

I monkey patched that line with this for now on my install:

try:
    row[position-1] = unicode(choice_list[row[position-1]])
except:
    row[position-1] = unicode(row[position-1])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant