[Answer]-Django: m2m relationship is not getting updated in post_save signal

1👍

Is it happen only then using django.admin app?
Can you change user status and save it in your own’s app?
Because django built-in admin does the following:

in the file django.contrib.admin.options.py
function change_view approx at 1053 line

if all_valid(formsets) and form_validated:
    self.save_model(request, new_object, form, True)
    self.save_related(request, form, formsets, True)
    change_message = self.construct_change_message(request, form, formsets)
    self.log_change(request, new_object, change_message)
    return self.response_change(request, new_object)

the line self.save_related(request, form, formsets, True) is executed AFTER saving the object at self.save_model(request, new_object, form, True), successfully erasing that you saved in your’s user_post_save.

👤Psion

Leave a comment