Add school classes to admin view
This commit is contained in:
parent
0c86c8ec1b
commit
7ca7dbe4dd
|
|
@ -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',)}),
|
||||
# )
|
||||
|
|
|
|||
Loading…
Reference in New Issue