django-cache-manager icon indicating copy to clipboard operation
django-cache-manager copied to clipboard

No support for custom querysets

Open ajenhl opened this issue 6 years ago • 0 comments

If a custom queryset is used by a manager, this is not available to the cache. For Django 1.10 at least, changing CacheManager.get_queryset() to:

def get_queryset(self):
    class_name = 'CustomCachingQuerySet'
    return type(class_name, (CachingQuerySet, self._queryset_class), {})(
        model=self.model, using=self._db)

and removing QuerySet from the superclasses of CachingQuerySet, means that the tests pass and the cached queryset has the methods of the custom queryset.

Is this worth working up a pull request for?

ajenhl avatar Apr 24 '18 00:04 ajenhl