[Django]-How do I override a get()/all()/filter() function in Django for lazy deletion?

7👍

Override get_query_set for your model manager

https://docs.djangoproject.com/en/dev/topics/db/managers/#modifying-initial-manager-querysets

class MyManager(models.Manager):
    def get_query_set(self):
        return super(MyManager, self).get_query_set().exclude(deleted=True)

Leave a comment