Fighting client-side caching in Django -


i'm using render_to_response shortcut , don't want craft specific response object add additional headers prevent client-side caching.

i'd have response contains:

  • pragma: no-cache
  • cache-control : no-cache
  • cache-control: must-revalidate

and other nifty ways browsers interpret directives avoid caching.

is there no-cache middleware or similar can trick minimal code intrusion?

you can achieve using cache_control decorator. example documentation:

from django.views.decorators.cache import never_cache  @never_cache def myview(request):    # ... 

Comments

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -