Opened 7 years ago
Last modified 7 years ago
#29147 closed Bug
Postgres JSONField missing to_python — at Initial Version
Reported by: | Javier Buzzi | Owned by: | |
---|---|---|---|
Component: | contrib.postgres | Version: | 1.9 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | yes | UI/UX: | no |
Description
Every other field implements a to_python except for JSONField:
https://github.com/django/django/blob/master/django/contrib/postgres/fields/hstore.py#L38
https://github.com/django/django/blob/master/django/contrib/postgres/fields/array.py#L102
https://github.com/django/django/blob/master/django/contrib/postgres/fields/ranges.py#L47
JSONField defaults to the value, meaning if you pass '{"object": "value"}'
you get back '{"object": "value"}'
. The same example in HStoreField, you pass in '{"object": "value"}'
you get back {"object": "value"}
-- makes the world of difference.