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
|
add_form = CustomUserCreationForm
|
||||||
form = CustomUserChangeForm
|
form = CustomUserChangeForm
|
||||||
model = User
|
model = User
|
||||||
list_display = ('username', 'first_name', 'last_name',)
|
list_display = ('username', 'first_name', 'last_name', 'school_classes_list')
|
||||||
|
list_filter = ('school_classes',)
|
||||||
|
|
||||||
inlines = [
|
inlines = [
|
||||||
SchoolClassInline,
|
SchoolClassInline,
|
||||||
RoleInline,
|
RoleInline,
|
||||||
]
|
]
|
||||||
|
|
||||||
|
def school_classes_list(self, obj):
|
||||||
|
return ', '.join([s.name for s in obj.school_classes.all()])
|
||||||
|
|
||||||
# fieldsets = UserAdmin.fieldsets + (
|
# fieldsets = UserAdmin.fieldsets + (
|
||||||
# (None, {'fields': ('school_classes',)}),
|
# (None, {'fields': ('school_classes',)}),
|
||||||
# )
|
# )
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue