src/notes/admin/auth.py
author ymh <ymh.work@gmail.com>
Fri, 30 Nov 2018 10:53:15 +0100
changeset 183 f8f3af9e5c83
parent 24 3b3999550508
permissions -rw-r--r--
Change the settings to avoid using Session authentication for rest framework as it raise exceptions in case client and backend are on the same domain On the filter, adapt to take into account new version of django_filters
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
24
3b3999550508 first data model for backend
ymh <ymh.work@gmail.com>
parents:
diff changeset
     1
from django.contrib import admin
3b3999550508 first data model for backend
ymh <ymh.work@gmail.com>
parents:
diff changeset
     2
from django.contrib.auth.admin import GroupAdmin as BaseGroupAdmin
3b3999550508 first data model for backend
ymh <ymh.work@gmail.com>
parents:
diff changeset
     3
from django.contrib.auth.admin import UserAdmin as BaseUserAdmin
3b3999550508 first data model for backend
ymh <ymh.work@gmail.com>
parents:
diff changeset
     4
3b3999550508 first data model for backend
ymh <ymh.work@gmail.com>
parents:
diff changeset
     5
from notes.models import GroupProfile, UserProfile
3b3999550508 first data model for backend
ymh <ymh.work@gmail.com>
parents:
diff changeset
     6
3b3999550508 first data model for backend
ymh <ymh.work@gmail.com>
parents:
diff changeset
     7
3b3999550508 first data model for backend
ymh <ymh.work@gmail.com>
parents:
diff changeset
     8
# Define an inline admin descriptor for Employee model
3b3999550508 first data model for backend
ymh <ymh.work@gmail.com>
parents:
diff changeset
     9
# which acts a bit like a singleton
3b3999550508 first data model for backend
ymh <ymh.work@gmail.com>
parents:
diff changeset
    10
class UserProfileInline(admin.StackedInline):
3b3999550508 first data model for backend
ymh <ymh.work@gmail.com>
parents:
diff changeset
    11
    model = UserProfile
3b3999550508 first data model for backend
ymh <ymh.work@gmail.com>
parents:
diff changeset
    12
    can_delete = False
3b3999550508 first data model for backend
ymh <ymh.work@gmail.com>
parents:
diff changeset
    13
3b3999550508 first data model for backend
ymh <ymh.work@gmail.com>
parents:
diff changeset
    14
# Define a new User admin
3b3999550508 first data model for backend
ymh <ymh.work@gmail.com>
parents:
diff changeset
    15
class UserAdmin(BaseUserAdmin):
3b3999550508 first data model for backend
ymh <ymh.work@gmail.com>
parents:
diff changeset
    16
    inlines = (UserProfileInline, )
3b3999550508 first data model for backend
ymh <ymh.work@gmail.com>
parents:
diff changeset
    17
3b3999550508 first data model for backend
ymh <ymh.work@gmail.com>
parents:
diff changeset
    18
3b3999550508 first data model for backend
ymh <ymh.work@gmail.com>
parents:
diff changeset
    19
class GroupProfileInline(admin.StackedInline):
3b3999550508 first data model for backend
ymh <ymh.work@gmail.com>
parents:
diff changeset
    20
    model = GroupProfile
3b3999550508 first data model for backend
ymh <ymh.work@gmail.com>
parents:
diff changeset
    21
    can_delete = False
3b3999550508 first data model for backend
ymh <ymh.work@gmail.com>
parents:
diff changeset
    22
3b3999550508 first data model for backend
ymh <ymh.work@gmail.com>
parents:
diff changeset
    23
3b3999550508 first data model for backend
ymh <ymh.work@gmail.com>
parents:
diff changeset
    24
class GroupAdmin(BaseGroupAdmin):
3b3999550508 first data model for backend
ymh <ymh.work@gmail.com>
parents:
diff changeset
    25
    inlines = (GroupProfileInline, )