Problem
Django models send the signal post_save
when a model is saved. The post_save
, however, does not have access to the request object. I need to access variables like request.user
and send it with the signal.
Possible solutions
Admin - Override admin
save_model
to sendpost_save
with some extra parameters from the request object.DRF API - After a model is created or updated, send
post_save
, again with parameters from the request object.
Question
In both the above cases, model.save()
will send the post_save
by default. How can I override save
to either send a custom signal or resend post_save
with request.user
. How should this be done?