diff --git a/common/site/userprofileadmin.py b/common/site/userprofileadmin.py index ddf2d7f..187645f 100644 --- a/common/site/userprofileadmin.py +++ b/common/site/userprofileadmin.py @@ -37,6 +37,7 @@ class UserProfileAdmin(admin.ModelAdmin): 'user_full_name', 'contact_email', 'contact_phone', + 'language', ] ordering = ('user__username',) search_fields = ( @@ -45,7 +46,7 @@ class UserProfileAdmin(admin.ModelAdmin): 'user__last_name', 'user__email' ) - readonly_fields = ('contact_email', 'language_code') + readonly_fields = ('contact_email', 'language_code', 'language') # -- ModelAdmin methods -- # @@ -115,22 +116,29 @@ def contact_email(self, obj): def contact_phone(self, obj): return obj.pbx_number - @admin.display(description=person_outline_icon) - def user_full_name(self, obj): - return f"{obj.user.first_name} {obj.user.last_name}" + @admin.display(description=_('Language')) + def language(self, obj): + lang = next(( + lang[1] for lang in settings.LANGUAGES + if lang[0] == obj.language_code + ), LEADERS) + return lang @admin.display(description=timezone_icon) def timezone(self, obj): - if obj.activate_timezone: return mark_safe( f'