I'd like to create a feature for my Django app similar to Django admin's 'Recent Actions', in order to store history information on my other models.
For example say I have two models called Book and Author. I want to have a third model that stores information such as what action was performed on a given object in a model (add, modify, delete, etc.) by who and when.
Who, when and the action are easy, I'm just unsure about how to store information regarding what object the action was performed on.
My initial idea was to have a 'Transactions' model that would store this information, and both my Book and Author models could have a ForeignKey relation to it. However, if I delete the given book or author, then its transaction history is also deleted and I have no record that this object was indeed deleted.
I've been thinking of other possible solutions, but I thought I'd ask for more experienced opinions here first. How should I approach this problem and what are some reasonable solutions to it?
Thanks!