#28534: Changing JSONField on inline in admin doesn't always trigger change
-----------------------------------------+------------------------
               Reporter:  john-parton    |          Owner:  nobody
                   Type:  Uncategorized  |         Status:  new
              Component:  Forms          |        Version:  1.11
               Severity:  Normal         |       Keywords:
           Triage Stage:  Unreviewed     |      Has patch:  0
    Needs documentation:  0              |    Needs tests:  0
Patch needs improvement:  0              |  Easy pickings:  0
                  UI/UX:  0              |
-----------------------------------------+------------------------
 If you have an inline with a JSONField and an initial value of {'key': 1}
 and you try to change it to {'key': True} without any other changes, the
 admin won't save your change. I believe this is because
 JSONField.has_changed() just uses simple equality checking and {'key':
 True} == {'key': 1} with a basic equality test in python.

 Here's the minimal test case:

 {{{
 >>> from django.contrib.postgres.forms import JSONField
 >>> JSONField().has_changed({'a': True}, '{"a": 1}')
 False
 }}}

 Let me know if there's any other information you need.

 Thanks.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/28534>
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/054.9bb917163b47db6079081d2a53858ea7%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to