Skip to content

Instantly share code, notes, and snippets.

@zhasm
Created May 17, 2013 06:55
Show Gist options
  • Save zhasm/5597388 to your computer and use it in GitHub Desktop.
Save zhasm/5597388 to your computer and use it in GitHub Desktop.
django no cache decorator.
def no_cache():
def decorator(f):
def wrapper(*args, **kwargs):
response = f(*args, **kwargs)
response['Last-Modified'] = time.strftime("%a, %d %b %Y %H:%M:%S GMT", time.gmtime())
response['Expires'] = 'Wed, 11 Jan 1984 05:00:00 GMT'
response['Cache-Control'] = 'no-cache, must-revalidate, max-age=0'
response['Pragma'] = 'no-cache'
return response
return wrapper
return decorator
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment