Add Django guardian

This commit is contained in:
Alexandre Iooss 2019-07-08 14:22:41 +02:00
parent a60dc70172
commit f8c972d49c
No known key found for this signature in database
GPG Key ID: 6C79278F3FCDCC02
2 changed files with 11 additions and 6 deletions

View File

@ -9,7 +9,6 @@ from django.utils.translation import gettext_lazy as _
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/
@ -20,14 +19,13 @@ SECRET_KEY = 'CHANGE_ME_IN_LOCAL_SETTINGS!'
DEBUG = True
ADMINS = (
#('Admin', 'webmaster@example.com'),
# ('Admin', 'webmaster@example.com'),
)
SITE_ID = 1
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = [
@ -44,6 +42,9 @@ INSTALLED_APPS = [
'django.contrib.messages',
'django.contrib.staticfiles',
# External apps
'guardian',
# Note apps
'adherents',
]
@ -81,7 +82,6 @@ TEMPLATES = [
WSGI_APPLICATION = 'note_kfet.wsgi.application'
# Database
# https://docs.djangoproject.com/en/2.2/ref/settings/#databases
@ -92,7 +92,6 @@ DATABASES = {
}
}
# Password validation
# https://docs.djangoproject.com/en/2.2/ref/settings/#auth-password-validators
@ -111,6 +110,12 @@ AUTH_PASSWORD_VALIDATORS = [
},
]
# Django Guardian object permissions
AUTHENTICATION_BACKENDS = (
'django.contrib.auth.backends.ModelBackend', # this is default
'guardian.backends.ObjectPermissionBackend',
)
# Internationalization
# https://docs.djangoproject.com/en/2.2/topics/i18n/
@ -130,7 +135,6 @@ USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/2.2/howto/static-files/

View File

@ -2,3 +2,4 @@ Django==2.2.3
pytz==2019.1
sqlparse==0.3.0
docutils==0.14
django-guardian==1.4.9