Don't serialize *_ptr fields in logs

This commit is contained in:
Yohann D'ANELLO 2020-08-15 22:54:16 +02:00
parent 5abbb84254
commit 1186b0f9a9
1 changed files with 3 additions and 0 deletions

View File

@ -86,6 +86,9 @@ def save_object(sender, instance, **kwargs):
# On ne garde que les champs modifiés
changed_fields = []
for field in instance._meta.fields:
if field.name.endswith("_ptr"):
# A field ending with _ptr is a OneToOneRel with a subclass, e.g. NoteClub.note_ptr -> Note
continue
if getattr(instance, field.name) != getattr(previous, field.name):
changed_fields.append(field.name)