[Django]-Django: don't cache particular view?

9👍

To be sure, decorate it with @never_cache:

from django.views.decorators.cache import never_cache

@never_cache
def myview(request):
    # ...

As in The per-view cache documentation.

0👍

Django does not cache views unless you specify a per-view cache.

If you have problems with (cached) Ajax responses, try to add a timestamp to your URL:

e.g. /my_view?ts=23432453453

So you can be sure that your browser does not cache the Ajax responses.

Leave a comment