diff --git a/common/djangoapps/student/admin.py b/common/djangoapps/student/admin.py index 127290243d..677b74b1bf 100644 --- a/common/djangoapps/student/admin.py +++ b/common/djangoapps/student/admin.py @@ -314,6 +314,7 @@ class CourseEnrollmentAdmin(DisableEnrollmentAdminMixin, admin.ModelAdmin): def get_queryset(self, request): return super().get_queryset(request).select_related('user') # lint-amnesty, pylint: disable=no-member, super-with-arguments + @method_decorator(login_required, name='dispatch') class LanguageAutocomplete(Select2ListView): def get_list(self): @@ -321,6 +322,7 @@ class LanguageAutocomplete(Select2ListView): return [] return [lang for lang in LANGUAGE_CHOICES if self.q.lower() in lang.lower()] + @method_decorator(login_required, name='dispatch') class CountryAutocomplete(Select2ListView): """ @@ -350,6 +352,7 @@ class CountryAutocomplete(Select2ListView): """ What gets sent back on selection (the code) """ return item + class UserProfileInlineForm(forms.ModelForm): """ A custom form for editing the UserProfile model within the admin inline. diff --git a/common/djangoapps/student/tests/test_admin_views.py b/common/djangoapps/student/tests/test_admin_views.py index 00aab7c3f0..968ba330a9 100644 --- a/common/djangoapps/student/tests/test_admin_views.py +++ b/common/djangoapps/student/tests/test_admin_views.py @@ -33,7 +33,6 @@ from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase # from xmodule.modulestore.tests.factories import CourseFactory # lint-amnesty, pylint: disable=wrong-import-order - class AdminCourseRolesPageTest(SharedModuleStoreTestCase): """Test the django admin course roles form saving data in db. """