1
0
mirror of https://gitlab.crans.org/bde/nk20 synced 2024-12-24 00:12:23 +00:00

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

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)