Opened 88 minutes ago
Last modified 80 minutes ago
#37122 new Uncategorized
JSONField has_changed doesn't reflect disabled correctly — at Initial Version
| Reported by: | alex | Owned by: | |
|---|---|---|---|
| Component: | Uncategorized | Version: | 6.0 |
| 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
Problem:
A disabled JSONField still reports changes via has_changed.
Why?
` python
def has_changed(self, initial, data):
# here we miss the check for disabled
if super().has_changed(initial, data):
return True
...
`
As we see, has_changed from the base is called and if successful, True is returned. But we have no additional check for disabled.
Fix:
` python
def has_changed(self, initial, data):
if self.disabled:
return False
if super().has_changed(initial, data):
return True
...
`
This corrupts the changed fields in the history of admin.