1
0
mirror of https://github.com/django/django.git synced 2025-10-24 14:16:09 +00:00

Fixed #14825 -- LocaleMiddleware keeps language

* LocaleMiddleware stores language into session if it is not present there.
This commit is contained in:
Vlastimil Zíma
2013-03-25 15:45:24 +01:00
committed by Claude Paroz
parent 1514f17aa6
commit 6de81d65f4
4 changed files with 42 additions and 1 deletions

View File

@@ -53,6 +53,10 @@ class LocaleMiddleware(object):
request.get_host(), language, request.get_full_path())
return HttpResponseRedirect(language_url)
# Store language back into session if it is not present
if hasattr(request, 'session'):
request.session.setdefault('django_language', language)
if not (self.is_language_prefix_patterns_used()
and language_from_path):
patch_vary_headers(response, ('Accept-Language',))