|August 3, 2011||Posted by admin under Programming|
Inspired by a post on override the default model manager to support soft-deleting objects in the database, I decided to implement it into one of my projects. (Yes, I know it’s an old post but it was new to me!).
However, just being able to filter the query sets returned to exclude items which had deleted=true wasn’t enough for what I wanted to do. Nor was just customizing the django’s admin interface to filter by on whether or not deleted was true or false. I wanted the modified manager and objects to soft-delete all related objects (models that referenced the object-being-deleted via a ForeignKey).