Fighting client-side caching in Django

前端 未结 7 936
傲寒
傲寒 2020-11-27 13:18

I\'m using the render_to_response shortcut and don\'t want to craft a specific Response object to add additional headers to prevent client-side caching.

I\'d like to

7条回答
  •  情书的邮戳
    2020-11-27 14:05

    You can achieve this using the cache_control decorator. Example from the documentation:

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

提交回复
热议问题