This is a follow-up to issue #750. While v3.3.0 fixed the issue for the originally reported field TimeField, there is now a problem with a DateTimeField.
Environment
Python: 3.12
django-auditlog: 3.3.0
AUDITLOG_STORE_JSON_CHANGES: False
Model
class TestModel(Model):
text = models.CharField(default="abc")
datetime = models.DateTimeField(null=True, blank=True)
Steps
- Create and save a NEW instance of the model with
text="abc", datetime=None.
- When
old_value and new_value get calculated for the field datetime, their values are "None" (old_value) and None (new_value), which means that they do not match and the field datetime gets added to the diff variable as (None, None).