I realize that this is a known problem, problem but I still have not found and adequate solution.
I want to use the @cache_page for a some views in my Django apps, like so:
@cache_page(24 * 60 * 60)
def some_view(request):
...
The problem is that I am also using i18n with a language switcher to switch languages of each page. So, if I turn on the caching I do not get the results I expect. It seems I get whatever was the last cached page.
I have tried this:
@cache_page(24 * 60 * 60)
@vary_on_headers('Content-Language', 'Accept-Language')
def some_view(request):
...
EDIT …and this:
@cache_page(24 * 60 * 60)
@vary_on_cookie
def some_view(request):
...
END EDIT
But I get the same results.
Of course, if I remove the caching everything works as expected.
Any help would be MUCH appreciated.
Ok – there seemed to be issues with the browser cache and not with Django itself. I have since found it useful to turn off all browser caching in development (seems obvious I know).