I'm trying to use an the 'update_fields' argument passed to signals in Django.
I've got something very simple for now, namely:
@receiver(pre_save, sender=models.UserAdmin)
@receiver(pre_save, sender=models.UserGroupAdmin)
def update_timestamps(sender, instance, update_fields, **kwargs):
print(f'Update fields: {update_fields}')
update_fields
shows as None no matter what is being updated, which indicates I've not understood something.
What am I missing?
update_fields
The set of fields to update as passed to Model.save(), or None if update_fields wasn’t passed to save().
update_fields just pass up fields that you have in set in save()
method for update
They are not fields that are updated in particular case ( you could set few fields in this list but maybe only one of them will actually change in database)