X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/01e3154575d718ae51e55e7ea8d064718e7d0037..0f2ac86f03177aebee66a3890120d9926272cf27:/src/team/admin.py diff --git a/src/team/admin.py b/src/team/admin.py index cff63219..b8c448a1 100644 --- a/src/team/admin.py +++ b/src/team/admin.py @@ -1,10 +1,24 @@ from django.contrib import admin +from django.contrib.auth.admin import UserAdmin +from django.contrib.auth.models import User from . import models -@admin.register(models.Profile) -class ProfileAdmin(admin.ModelAdmin): - list_display = ['user', 'presence'] +class ProfileInline(admin.StackedInline): + model = models.Profile + can_delete = False + + +class CustomUserAdmin(UserAdmin): + inlines = (ProfileInline, ) + + def get_inline_instances(self, request, obj=None): + if not obj: + return list() + return super(CustomUserAdmin, self).get_inline_instances(request, obj) + +admin.site.unregister(User) +admin.site.register(User, CustomUserAdmin) @admin.register(models.Presence)