Open duebbert opened 2 years ago
Facing a similar issue, in that when I delete an object it cascade deletes another model's object that I refer to in the pre_create_historical_record
signal, so I cannot access it anymore.
Ideally, I want to pass additional information on delete (and even on save) to the signal handler, but that might be more complicated to implement so @duebbert 's suggested implementation is simple and will suffice.
Alternatively, if the history type
attribute can be passed in to the signal which is super easy to implement, it will allow users to have more custom control on how to handle create, edit and delete events differently.
Problem Statement There is no attribute to skip saving a delete history entry when deleting an object.
Describe the solution you'd like Either
skip_history_when_saving
on the object should be honoured (like in thepost_save
method) or a newskip_history_when_deleting
attribute should be introduced.Describe alternatives you've considered I'm hacking the settings to temporarily set
SIMPLE_HISTORY_ENABLED = False
to avoid saving it.Additional context Implementation should be pretty straightforward like in the
post_save
method: https://github.com/jazzband/django-simple-history/blob/106266f6d68f74d2d56b0553a368ca8070d5cbc4/simple_history/models.py#L541