Overwriting Manager in Django using django-cache-machine
问题 Since the django-cache-machine override the objects model attribute, the right way to modify the queryset is as follows: class ModelAQuerySet(models.query.QuerySet): def foo(self): return self.filter(name='foo') class ModelAManager(base.CachingManager): def __init__(self): super(ModelAManager, self).__init__() def get_query_set(self): return ModelAQuerySet(self.model, using=self._db) def foo(self): return self.get_query_set().foo() class ModelA(base.CachingMixin, models.Model): #fields ...