ojuso-map/ojusomap/views.py

14 lines
497 B
Python
Raw Normal View History

2018-05-19 17:52:19 +00:00
from django.utils import translation
from django.views.i18n import set_language
from django.views.generic import View
class LanguageDropdownView(View):
def get(self, request, *args, **kwargs):
lang_code = kwargs.get('language', None)
if lang_code is not None and translation.check_for_language(lang_code):
request.POST = request.POST.copy()
request.POST['language'] = lang_code
request.method = 'POST'
return set_language(request)