#29147: Postgres JSONField missing to_python
-------------------------------------+-------------------------------------
Reporter: Javier Buzzi | Owner: Williams
| Mendez
Type: Bug | Status: closed
Component: contrib.postgres | Version: 1.9
Severity: Normal | Resolution: invalid
Keywords: | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Javier Buzzi):
* has_patch: 0 => 1
Old 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.
New 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.
PR. https://github.com/django/django/pull/9801
--
--
Ticket URL: <https://code.djangoproject.com/ticket/29147#comment:15>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/069.3c0d35104266a88b29705f8948b35651%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.