chibisov / drf-extensions

DRF-extensions is a collection of custom extensions for Django REST Framework
http://chibisov.github.io/drf-extensions/docs
MIT License
1.47k stars 208 forks source link

cache decorator ignores query string #169

Open grudelsud opened 7 years ago

grudelsud commented 7 years ago

hi

I'm using a cache decorator for a list viewset as follows:

@cache_response()
def list(self, request, *args, **kwargs):
    queryset = self.filter_queryset(self.get_queryset())
    serializer = self.get_serializer(queryset, many=True)
    return Response(serializer.data)

but the query string parameters seem to be ignored, e.g.

any suggestion to make this work? I understand I can specify a key_func on the cache_response arguments but I'm a bit lost in how to implement it and not sure it would solve the problem

thanks!

manasvi-livspace commented 7 years ago

Hi, I am also stuck in same situation. I have a get API but it is returning cached response even if I pass different value for query parameter. Did you get a solution for this?

manasvi-livspace commented 7 years ago

I got a solution for this. Please check http://stackoverflow.com/questions/43101423/drf-extension-cache-ignoring-query-parameters/43113799#43113799