This commit is contained in:
Bertrand Bordage 2017-04-19 14:46:35 +02:00
parent 72a935a8f0
commit 15daeb80d2
2 changed files with 4 additions and 5 deletions

View file

@ -2,9 +2,8 @@ from __future__ import absolute_import, unicode_literals
from django.contrib.auth.views import redirect_to_login as auth_redirect_to_login
from django.core.urlresolvers import reverse
from django.utils.translation import activate as activate_lang
from django.utils.translation import ugettext as _
from django.utils.translation import activate
from wagtail.utils.compat import user_is_anonymous
from wagtail.wagtailadmin import messages
@ -24,7 +23,7 @@ def require_admin_access(view_func):
if user.has_perms(['wagtailadmin.access_admin']):
if hasattr(user, 'wagtail_userprofile'):
activate(user.wagtail_userprofile.get_preferred_language())
activate_lang(user.wagtail_userprofile.get_preferred_language())
return view_func(request, *args, **kwargs)
messages.error(request, _('You do not have permission to access the admin'))

View file

@ -293,8 +293,8 @@ class TestAccountSection(TestCase, WagtailTestUtils):
def test_language_preferences_view_post(self):
"""
This post to the language preferences view and checks that the
user's profile is updated
This posts to the language preferences view and checks that the
user profile is updated
"""
# Post new values to the language preferences page
post_data = {