From 38944b836bdaaa2ef67fa1783bfe15a55a05b90c Mon Sep 17 00:00:00 2001 From: Simon Chen Date: Thu, 30 Sep 2021 11:34:59 -0400 Subject: [PATCH] fix: Create a better admin UI for PendingNameChange model (#28888) The current admin UI for the PendingNameChange model has no useful info and is not performant on edit form. This change make the view and edit of the model easier in django admin Co-authored-by: Simon Chen --- common/djangoapps/student/admin.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/common/djangoapps/student/admin.py b/common/djangoapps/student/admin.py index a5ead71d04..25d6413ab9 100644 --- a/common/djangoapps/student/admin.py +++ b/common/djangoapps/student/admin.py @@ -552,9 +552,20 @@ class UserCelebrationAdmin(admin.ModelAdmin): def has_module_permission(self, request): return False + +@admin.register(PendingNameChange) +class PendingNameChangeAdmin(admin.ModelAdmin): + """Admin interface for the Pending Name Change model""" + readonly_fields = ('user', ) + list_display = ('user', 'new_name', 'rationale') + search_fields = ('user', 'new_name') + + class Meta: + model = PendingNameChange + + admin.site.register(UserTestGroup) admin.site.register(Registration) -admin.site.register(PendingNameChange) admin.site.register(AccountRecoveryConfiguration, ConfigurationModelAdmin) admin.site.register(DashboardConfiguration, ConfigurationModelAdmin) admin.site.register(RegistrationCookieConfiguration, ConfigurationModelAdmin)