diff --git a/note_kfet/settings.py b/note_kfet/settings.py index 72572b57..b0fe2eb8 100644 --- a/note_kfet/settings.py +++ b/note_kfet/settings.py @@ -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/ diff --git a/requirements.txt b/requirements.txt index bd1e6a55..b4497b5a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,3 +2,4 @@ Django==2.2.3 pytz==2019.1 sqlparse==0.3.0 docutils==0.14 +django-guardian==1.4.9 \ No newline at end of file