I have some post-save signal which is trigged after the save of some model:
@receiver(signals.post_save, sender=Books)
def log_book_create_and_edit(sender, instance, **kwargs):
if kwargs['created']:
log_entry = AuditEvent.objects.create(
event_type='Create',
event_model='Book')
else:
log_entry = AuditEvent.objects.create(
event_type='Create',
event_model='Book')
log_entry.save()
I'd like to be able to keep track of changes to the actual fields of the Book
model. One way to do that is to save a serialized model instance and then use that to compare pre- and post-save states. However, is there a way to do that directly, without having to save the serialized model instance?