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

1.4.1 regression: TypeError: Decimal is not JSON serializable #144

Closed
prokaktus opened this issue Feb 1, 2016 · 3 comments
Closed

1.4.1 regression: TypeError: Decimal is not JSON serializable #144

prokaktus opened this issue Feb 1, 2016 · 3 comments
Labels

Comments

@prokaktus
Copy link
Contributor

Hello!

This issue introduced by commit 3b235cb.

django-hstore version: 1.4.1
django version: 1.7
python version: 2.7.6

Problem description:
My model have field hstore.DictionaryField. Before 1.4.1, in method ensure_acceptable_value, code

return force_text(json.dumps(value))

            ...
            elif isinstance(value, (list, dict)):
                return force_text(json.dumps(value))
           ...

works well with Decimal objects in lists, because simplejson supports dumps for Decimals. But standard python json not. Because of that I get TypeError: Decimal('10') is not JSON serializable

@nemesifier
Copy link
Member

Please send a failing test with a patch.

@prokaktus
Copy link
Contributor Author

Now it can be closed.

@nemesifier
Copy link
Member

Thank you @prokaktus

@nemesifier nemesifier added the bug label Apr 2, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants