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

ruby - When to use an ORM (Sequel, Datamapper, AR, etc.) vs. pure SQL for querying -

php - PHPDoc: @return void necessary? -

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