Add admin filters
This commit is contained in:
parent
6c63027834
commit
ff96cba446
|
|
@ -112,8 +112,10 @@ class UserAdmin(auth_admin.UserAdmin):
|
|||
"last_name",
|
||||
"is_active",
|
||||
"is_superuser",
|
||||
"organisation",
|
||||
"sso_id",
|
||||
]
|
||||
list_filter = ("is_staff", "is_superuser", "is_active", "groups", "organisation")
|
||||
search_fields = ["first_name", "last_name", "email", "username", "sso_id"]
|
||||
actions = [create_or_sync_berufsbildner]
|
||||
|
||||
|
|
|
|||
|
|
@ -66,6 +66,7 @@ class CourseSessionUserAdmin(admin.ModelAdmin):
|
|||
"circles",
|
||||
"optional_attendance",
|
||||
"user_sso_id",
|
||||
"user_organisation",
|
||||
# "created_at",
|
||||
# "updated_at",
|
||||
]
|
||||
|
|
@ -79,6 +80,7 @@ class CourseSessionUserAdmin(admin.ModelAdmin):
|
|||
"role",
|
||||
"course_session",
|
||||
"optional_attendance",
|
||||
"user__organisation",
|
||||
]
|
||||
raw_id_fields = [
|
||||
"user",
|
||||
|
|
@ -102,6 +104,12 @@ class CourseSessionUserAdmin(admin.ModelAdmin):
|
|||
user_sso_id.short_description = "SSO ID"
|
||||
user_sso_id.admin_order_field = "user__sso_id"
|
||||
|
||||
def user_organisation(self, obj):
|
||||
return obj.user.organisation
|
||||
|
||||
user_organisation.short_description = "Organisation"
|
||||
user_organisation.admin_order_field = "user__organisation"
|
||||
|
||||
def circles(self, obj):
|
||||
return ", ".join([c.title for c in obj.expert.all()])
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue