Install django-guardian

This commit is contained in:
Evert Prants 2017-12-11 19:23:19 +02:00
parent 5f8d142508
commit 94931900e5
Signed by: evert
GPG Key ID: 1688DA83D222D0B5
3 changed files with 9 additions and 1 deletions

View File

@ -44,6 +44,7 @@ ALLOWED_HOSTS = []
AUTHENTICATION_BACKENDS = (
'LandingPage.backends.OAuthBackend',
'guardian.backends.ObjectPermissionBackend',
'django.contrib.auth.backends.ModelBackend',
)
@ -59,6 +60,7 @@ INSTALLED_APPS = [
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'guardian',
]
MIDDLEWARE = [

View File

@ -3,6 +3,8 @@ from django.contrib.auth.admin import UserAdmin
from .models import *
from .forms import SpecialUserChangeForm
from guardian.admin import GuardedModelAdmin
class SpecialUserAdmin(UserAdmin):
form = SpecialUserChangeForm
@ -10,8 +12,11 @@ class SpecialUserAdmin(UserAdmin):
(None, {'fields': ('display_name',)}),
)
class ShowAdmin(GuardedModelAdmin):
pass
# Register your models here.
admin.site.register(Show)
admin.site.register(Show, ShowAdmin)
admin.site.register(User, SpecialUserAdmin)
admin.site.register(Ban)
admin.site.register(ShowModerator)

View File

@ -2,3 +2,4 @@ Django==1.11.4
Pillow==4.2.1
dj-database-url==0.4.2
requests==2.18.4
django-guardian==1.4.9