1 2 3 4 5 6 7 8 9 | frm django.shortcuts import render_to_response
def render_to_json(*args, **kwargs):
response = render_to_response(*args, **kwargs)
response['mimetype'] = "text/javascript"
response['Pragma'] = "no cache"
response['Cache-Control'] = "no-cache, must-revalidate"
return response
|
More like this
- Template filters utils by marinho 5 years, 6 months ago
- Admin list_display Ajax by whiteinge 5 years, 3 months ago
- Generic csv export admin action by dek 3 years, 8 months ago
- Bind Administration by ashcrow 4 years, 8 months ago
- Export Related as JSON Admin Action by johnboxall 3 years, 10 months ago
Comments
JSON doesn't necessarily mean no cache. Don't blindly copy-paste; think about if your data can be cached.
#