src/notes/admin/auth.py
author ymh <ymh.work@gmail.com>
Mon, 31 Jul 2017 23:18:38 +0200
changeset 131 adad5563603c
parent 24 3b3999550508
permissions -rw-r--r--
add personal group, default_group to users and add group info to session on backend

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

from notes.models import GroupProfile, UserProfile


# Define an inline admin descriptor for Employee model
# which acts a bit like a singleton
class UserProfileInline(admin.StackedInline):
    model = UserProfile
    can_delete = False

# Define a new User admin
class UserAdmin(BaseUserAdmin):
    inlines = (UserProfileInline, )


class GroupProfileInline(admin.StackedInline):
    model = GroupProfile
    can_delete = False


class GroupAdmin(BaseGroupAdmin):
    inlines = (GroupProfileInline, )