X-Git-Url: http://git.auf.org/?p=auf_rh_dae.git;a=blobdiff_plain;f=project%2Fsettings.py;h=4057f970465642b7a8cc9b77427e1d10ea4512e7;hp=3831b765e5bba5f45e47d80d0d0cdbb6a319c8b7;hb=9212117d53a85b4a66b85730f93ee3e0ca67ffe2;hpb=cf5662f17e2e26cb9c6f9edd126e708935adb2c3 diff --git a/project/settings.py b/project/settings.py index 3831b76..4057f97 100644 --- a/project/settings.py +++ b/project/settings.py @@ -2,44 +2,59 @@ import os import socket -from conf import * + +try: + from project.conf import * # NOQA +except ImportError: + pass + +from project.groups import DRH_NIVEAU_1, DRH_NIVEAU_2 + PROJET_TITRE = "Ressources humaines" # Rapports d'erreurs +SERVER_EMAIL = 'ne-pas-repondre@auf.org' EMAIL_SUBJECT_PREFIX = '[auf_rh_dae - %s] ' % socket.gethostname() -ADMINS = ( - ('Équipe ARI-SI', 'developpeurs@ca.auf.org'), -) +ADMINS = () MANAGERS = ADMINS TIME_ZONE = 'America/Montreal' +LANGUAGE_CODE = 'fr' +FORMAT_MODULE_PATH = 'project.formats' +USE_L10N = True +USE_THOUSAND_SEPARATOR = False DATE_FORMAT = 'd-m-Y' -DATE_INPUT_FORMATS = ( - '%d-%m-%Y', '%d/%m/%Y', '%d %m %Y', - '%d-%m-%y', '%d/%m/%y', '%d %m %y', -) +DATE_INPUT_FORMATS = ('%d-%m-%Y', ) -SHORT_DATE_FORMAT = 'd-m-Y' -LANGUAGE_CODE = 'fr-ca' +SESSION_SAVE_EVERY_REQUEST = True +SESSION_EXPIRE_AT_BROWSER_CLOSE = True + +PROJECT_ROOT = os.path.dirname(__file__) +SITE_ROOT = os.path.dirname(PROJECT_ROOT) # Absolute path to the directory that holds media. # Example: "/home/media/media.lawrence.com/" -MEDIA_ROOT = os.path.join(os.path.dirname(__file__), 'media') -PRIVE_MEDIA_ROOT = os.path.join(os.path.dirname(__file__), 'media_prive') +MEDIA_ROOT = os.path.join(PROJECT_ROOT, 'media') +PRIVE_MEDIA_ROOT = os.path.join(PROJECT_ROOT, 'media_prive') + +STATICFILES_DIRS = ( + os.path.join(PROJECT_ROOT, 'assets'), +) +STATIC_ROOT = os.path.join(PROJECT_ROOT, 'static') +STATIC_URL = '/static/' # URL that handles the media served from MEDIA_ROOT. Make sure to use a # trailing slash if there is a path component (optional in other cases). # Examples: "http://media.lawrence.com", "http://example.com/media/" MEDIA_URL = '/media/' -PRIVE_MEDIA_URL = '/rh/prive/' +PRIVE_MEDIA_URL = '/prive/' OE_PRIVE_MEDIA_URL = '/recrutement/prive/' - # URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a # trailing slash. # Examples: "http://foo.com/media/", "/media/". -ADMIN_MEDIA_PREFIX = '/media/django/' +#ADMIN_MEDIA_PREFIX = '/media/django/' # Don't share this with anybody. SECRET_KEY = '^2w#%abp_d+e#(7f5w$leef50)c@4y38cnn#ccji@84$2^rt#l' @@ -49,6 +64,8 @@ MIDDLEWARE_CLASSES = ( 'django.contrib.sessions.middleware.SessionMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', + 'auf.django.saml.middleware.SPMiddleware', + 'auf.django.piwik.middleware.TrackMiddleware', 'django.middleware.doc.XViewMiddleware', 'reversion.middleware.RevisionMiddleware', ) @@ -58,55 +75,55 @@ ROOT_URLCONF = 'project.urls' INSTALLED_APPS = ( 'auf.django.skin', 'auf.django.references', + 'auf.django.emploi', + 'auf.django.admingroup', + 'auf.django.workflow', + 'auf.django.permissions', + 'auf.django.emploi', + 'auf.django.saml', + 'auf.django.pong', + 'auf.django.export', 'admin_tools', 'admin_tools.theming', 'admin_tools.menu', 'admin_tools.dashboard', + 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', + 'django.contrib.humanize', 'django.contrib.messages', 'django.contrib.sessions', - 'django.contrib.admin', + 'django.contrib.staticfiles', 'django_qbe', - 'auf.django.emploi', - 'auf.django.admingroup', 'ajax_select', 'south', + 'raven.contrib.django', 'reversion', - 'auf.django.workflow', - 'auf.django.permissions', - #'project.rh_v1', - 'project.rh', - 'project.dae', - 'project.legacy', 'alphafilter', - 'auf.django.emploi', - 'project.recrutement', 'form_utils', 'tinymce', 'captcha', + 'project.rh', + 'project.dae', + 'project.recrutement', ) TEMPLATE_CONTEXT_PROCESSORS = ( - 'django.core.context_processors.auth', + 'django.contrib.auth.context_processors.auth', 'django.core.context_processors.debug', 'django.core.context_processors.i18n', 'django.core.context_processors.media', + 'django.core.context_processors.static', 'django.contrib.messages.context_processors.messages', 'django.core.context_processors.request', 'auf.django.skin.context_processors.auf', - 'project.context_processors.this_employe', - 'project.context_processors.user_is_admin', - 'dae.context_processors.user_in_dae_groupes', - 'recrutement.context_processors.user_in_recrutement_groupes', + 'project.dae.context_processors.user_in_dae_groupes', ) AUTHENTICATION_BACKENDS = ( - 'auf.django.auth.backends.CascadeBackend', + 'auf.django.saml.backends.SPBackend', 'auf.django.permissions.backends.AuthenticationBackend', ) -LOGIN_URL = "/connexion" -LOGIN_REDIRECT_URL = "/" TEMPLATE_DIRS = ( os.path.join(os.path.dirname(__file__), "templates"), @@ -118,38 +135,129 @@ ADMIN_TOOLS_APP_INDEX_DASHBOARD = 'project.dashboard.CustomAppIndexDashboard' ADMIN_TOOLS_MENU = 'project.menu.CustomMenu' AJAX_LOOKUP_CHANNELS = { - 'responsables' : ('dae.catalogues', 'Responsable'), - 'dossiers' : ('dae.catalogues', 'Dossier'), - 'postes' : ('dae.catalogues', 'Poste'), + 'responsables': ('project.dae.catalogues', 'Responsable'), + 'dae_dossiers': ('project.dae.catalogues', 'Dossier'), + 'dae_postes': ('project.dae.catalogues', 'Poste'), + 'pays': ('project.rh.catalogues', 'Pays'), + 'implantations': ('project.rh.catalogues', 'Implantation'), + 'typepostes': ('project.rh.catalogues', 'TypePoste'), + 'postes': ('project.rh.catalogues', 'Poste'), + 'valeurpoints': ('project.rh.catalogues', 'ValeurPoint'), + 'employes': ('project.rh.catalogues', 'Employe'), + 'dossiers': ('project.rh.catalogues', 'Dossier'), } +AJAX_SELECT_INLINES = 'inline' + TINYMCE_DEFAULT_CONFIG = { -'theme': "advanced", -'plugins':"paste", -'theme_advanced_buttons1' : "bold,italic,underline,|,formatselect,|,bullist,numlist,|,undo,redo,|,link,unlink", -'theme_advanced_buttons2' : "", -'theme_advanced_buttons3' : "", -'theme_advanced_statusbar_location' : "bottom", -'theme_advanced_toolbar_align' : "left", -'theme_advanced_styles' : "Titre=titre;Sous-titre=sous-titre;Normal=normal", -'width' : "800", -'height' : "200", -'theme_advanced_resizing' : "true", -'custom_undo_redo_levels': 10, -'theme_advanced_toolbar_location' : 'top', -'inline_styles' : 'false', -'paste_use_dialog' : 'false', -'paste_auto_cleanup_on_paste' : 'true', -'paste_convert_headers_to_strong' : 'false', -'paste_strip_class_attributes' : 'all', -'paste_remove_spans' : 'true', -'paste_remove_styles' : 'true', -'content_css' : '/media/css/tinymce.css', + 'theme': "advanced", + 'plugins': "paste", + 'theme_advanced_buttons1': ( + "bold,italic,underline,|,formatselect,|,bullist,numlist,|,undo,redo,|," + "link,unlink" + ), + 'theme_advanced_buttons2': "", + 'theme_advanced_buttons3': "", + 'theme_advanced_statusbar_location': "bottom", + 'theme_advanced_toolbar_align': "left", + 'theme_advanced_styles': "Titre=titre;Sous-titre=sous-titre;Normal=normal", + 'width': "800", + 'height': "200", + 'theme_advanced_resizing': "true", + 'custom_undo_redo_levels': 10, + 'theme_advanced_toolbar_location': 'top', + 'inline_styles': 'false', + 'paste_use_dialog': 'false', + 'paste_auto_cleanup_on_paste': 'true', + 'paste_convert_headers_to_strong': 'false', + 'paste_strip_class_attributes': 'all', + 'paste_remove_spans': 'true', + 'paste_remove_styles': 'true', + 'content_css': '/media/css/tinymce.css', } -DATABASE_ROUTERS = ( - 'project.legacy.DatabaseRouter', -) - # django-sendfile SENDFILE_BACKEND = 'sendfile.backends.simple' + +QBE_DISPLAY_DATABASES = False + +# Il est *très* important de respecter la case. +QBE_CUSTOM_MODELS = {'Rh': { + 'Employe': {}, + 'Poste': {}, + 'Dossier': {}, + 'Remuneration': {}, + 'Contrat': {}, +}} + +QBE_ALLOWED_FIELDS = {'Rh': { + 'Employe': [ + 'nom', 'prenom', 'genre', 'date_naissance', 'situation_familiale', + 'date_entree' + ], + 'Poste': ['nom', 'date_debut', 'date_fin'], + 'Dossier': [ + 'statut_residence', 'regime_travail', + 'regime_travail_nb_heure_semaine', 'date_debut', 'date_fin' + ], + 'Remuneration': ['montant', 'date_debut', 'date_fin'], + 'Contrat': ['date_debut', 'date_fin'], +}} + +SOUTH_TESTS_MIGRATE = False + +LOGGING = { + 'version': 1, + 'disable_existing_loggers': True, + 'root': { + 'level': 'WARNING', + 'handlers': ['sentry'], + }, + 'formatters': { + 'verbose': { + 'format': '%(levelname)s %(asctime)s %(module)s %(process)d %(thread)d %(message)s' + }, + }, + 'handlers': { + 'sentry': { + 'level': 'WARNING', + 'class': 'raven.contrib.django.handlers.SentryHandler', + }, + 'console': { + 'level': 'DEBUG', + 'class': 'logging.StreamHandler', + 'formatter': 'verbose' + } + }, + 'loggers': { + 'django.db.backends': { + 'level': 'ERROR', + 'handlers': ['console'], + 'propagate': False, + }, + 'raven': { + 'level': 'DEBUG', + 'handlers': ['console'], + 'propagate': False, + }, + 'sentry.errors': { + 'level': 'DEBUG', + 'handlers': ['console'], + 'propagate': False, + }, + }, +} + +CACHES = { + 'default': { + 'BACKEND': 'django.core.cache.backends.locmem.LocMemCache', + } +} + +# Pour accéder aux requêtes savegardées, il faut définir les permissions dans +# l'admin +def qbe_access(user): + grps_user = [g.name for g in user.groups.all()] + inter = [g for g in grps_user if g in (DRH_NIVEAU_1, DRH_NIVEAU_2, )] + return len(inter) > 0 +QBE_ACCESS_FOR = qbe_access