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

View keyword arguments not available in prefixer function

Open peterbe opened this issue 11 years ago • 2 comments

User Henri Witteveen reports that his prefixer function isn't being called with the same parameters as the view is.

peterbe avatar May 30 '13 15:05 peterbe

I had this issue too but got the view kwargs using the request resolver.

def my_prefix_function(request):
    # Get the parameters from the URL.
    view_kwargs = request.resolver_match.kwargs
    # Return a key.
    return '-'.join(i[1] for i in sorted(view_kwargs.items())

Hope this helps.

justin-fay avatar Nov 02 '20 09:11 justin-fay

I'm not using this library myself anymore. But if you are and you think that fix is important and easy to add, please create a PR. I think there are some unit tests that you could extend.

peterbe avatar Nov 02 '20 14:11 peterbe