mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-11-29 08:25:10 +00:00
Fix KeyError on first run when no language is set
This commit is contained in:
1 parent
aeaa6ab800
commit
027dd528db
1 file changed
+3
-2
@@ -59,8 +59,9 @@ def get_language(request):
|
||||
# taking care of setting language on login, and adapting kvstore when
|
||||
# renaming/deleting users
|
||||
|
||||
# The session contains more accurate information than request.LANGUAGE_CODE
|
||||
return request.session[translation.LANGUAGE_SESSION_KEY]
|
||||
# The information from the session is more accurate but not always present
|
||||
return request.session.get(translation.LANGUAGE_SESSION_KEY,
|
||||
request.LANGUAGE_CODE)
|
||||
|
||||
|
||||
class TrimmedCharField(forms.CharField):
|
||||
|
||||
Reference in new issue
Block a user