I would like to turn caching off for certain pages when that view is accessed. It's for a page that simply queries model objects.
it seems like when 'django.middleware.cache.FetchFromCacheMiddleware', is enabled, it requires another "refresh" from the browser to see the latest data.
Is there any way to prevent this?
Thank you.
https://docs.djangoproject.com/en/dev/topics/cache/#controlling-cache-using-other-headers
If you want to use headers to disable caching altogether, django.views.decorators.cache.never_cache is a view decorator that adds headers to ensure the response won't be cached by browsers or other caches. Example:
from django.views.decorators.cache import never_cache
@never_cache
def myview(request):
# ...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With