Add school classes to admin view

This commit is contained in:
Ramon Wenger 2019-07-04 10:18:23 +02:00
parent 0c86c8ec1b
commit 7ca7dbe4dd
1 changed files with 5 additions and 1 deletions

View File

@ -36,13 +36,17 @@ class CustomUserAdmin(UserAdmin):
add_form = CustomUserCreationForm
form = CustomUserChangeForm
model = User
list_display = ('username', 'first_name', 'last_name',)
list_display = ('username', 'first_name', 'last_name', 'school_classes_list')
list_filter = ('school_classes',)
inlines = [
SchoolClassInline,
RoleInline,
]
def school_classes_list(self, obj):
return ', '.join([s.name for s in obj.school_classes.all()])
# fieldsets = UserAdmin.fieldsets + (
# (None, {'fields': ('school_classes',)}),
# )