#28534: Changing JSONField on inline in admin doesn't always trigger change
-----------------------------+-------------------------------------
Reporter: john-parton | Owner: hui shang
Type: Bug | Status: assigned
Component: Forms | Version: 1.11
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------+-------------------------------------
Comment (by john-parton):
Here's some information that might be helpful:
[https://stackoverflow.com/questions/45888263/strict-comparison-of-
dictionaries-in-python]
It looks like there's two approaches:
1. Convert both the old value and new value to some string representation
and compare them. (Either using json.dumps or pprint.pformat)
2. Recursively compare the values
I think (1) with json.dumps would probably work best. pprint.pformat was
suggested to handle objects that can't be json-serialized, but obviously
everything that can go into a JSONField can be json-serialized.
--
Ticket URL: <https://code.djangoproject.com/ticket/28534#comment:4>
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.5899a89a4189927c3ed1fe49d41356ca%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.