from django.contrib import admin
from django.contrib.auth.admin import UserAdmin as BaseUserAdmin

from users.models import UserInfo, User


class UserInfoInline(admin.StackedInline):
    """ Define an inline admin descriptor for Employee model which acts a bit like a singleton """
    model = UserInfo
    can_delete = False
    verbose_name_plural = 'Additional user info'


class UserAdmin(BaseUserAdmin):
    inlines = (UserInfoInline,)


admin.site.unregister(User)
admin.site.register(User, UserAdmin)
