Using django simple history, is there a way to delete all the history associated with an object if the object itself is deleted? For example, if I have a User model:
User.objects.filter(id=to_delete_id).delete()
That query will delete that User, but it doesn't erase all the history, which I would like to save on data costs. Is there a way to automatically delete all of that specific user's history on delete, or do I have to do this:
User.objects.filter(id=to_delete_id).delete()
User.history.filter(id=to_delete_id).delete()
Thanks.
Nick :
I think I found a solution, let me know if this is bad for some performance reason:\n\nOverride the delete() method on a User:\n\nclass User(...):\n ...\n def delete(self):\n self.history.filter().delete()\n super(User, self).delete()\n",
2016-06-06T02:28:05