23 lines
645 B
Python
23 lines
645 B
Python
from django.contrib import admin
|
|
|
|
from vbv_lernwelt.learning_mentor.models import LearningMentor, MentorInvitation
|
|
|
|
|
|
@admin.register(LearningMentor)
|
|
class LearningMentorAdmin(admin.ModelAdmin):
|
|
def participant_count(self, obj):
|
|
return obj.participants.count()
|
|
|
|
participant_count.short_description = "Participants"
|
|
|
|
list_display = ["mentor", "course", "participant_count"]
|
|
|
|
search_fields = ["mentor__email"]
|
|
|
|
|
|
@admin.register(MentorInvitation)
|
|
class MentorInvitationAdmin(admin.ModelAdmin):
|
|
list_display = ["id", "email", "participant", "created"]
|
|
readonly_fields = ["id", "created"]
|
|
search_fields = ["email"]
|