@ensure_csrf_cookie
def update_session_language(request):
 if (request.method == 'PATCH'):
  data = json.loads(request.body)
  language = data.get(LANGUAGE_KEY, settings.LANGUAGE_CODE)
  if (request.session.get(LANGUAGE_SESSION_KEY, None) != language):
   request.session[LANGUAGE_SESSION_KEY] = unicode(language)
 return HttpResponse(200)

@ ensure_csrf_cookie def update_session_language ( request ) : if ( request . method == 'PATCH' ) : data = json . loads ( request . body ) language = data . get ( LANGUAGE_KEY , settings . LANGUAGE_CODE ) if ( request . session . get ( LANGUAGE_SESSION_KEY , None ) != language ) : request . session [ LANGUAGE_SESSION_KEY ] = unicode ( language ) return HttpResponse ( 200 )
update the language session key .