diff --git a/src/fellchensammlung/admin.py b/src/fellchensammlung/admin.py index 1764b8b..53952f7 100644 --- a/src/fellchensammlung/admin.py +++ b/src/fellchensammlung/admin.py @@ -1,8 +1,26 @@ from django.contrib import admin +from django.contrib.auth.admin import UserAdmin as BaseUserAdmin +from django.contrib.auth.models import User -from django.contrib import admin +from .models import Animal, Species, RescueOrganization, AdoptionNotice, Location, Rule, Image, ModerationAction, Report, Member -from .models import Animal, Species, RescueOrganization, AdoptionNotice, Location, Rule, Image, ModerationAction, Report + +# Define an inline admin descriptor for Employee model +# which acts a bit like a singleton +class MemberInline(admin.StackedInline): + model = Member + can_delete = False + verbose_name_plural = "member" + + +# Define a new User admin +class UserAdmin(BaseUserAdmin): + inlines = [MemberInline] + + +# Re-register UserAdmin +admin.site.unregister(User) +admin.site.register(User, UserAdmin) admin.site.register(Animal) admin.site.register(Species)