Routeur: Ajout temporaire des modules workflow et dae en écriture
[auf_rh_dae.git] / project / settings.py
1 # -*- encoding: utf-8 -*-
2
3 import os
4 import socket
5
6 try:
7 from project.conf import * # NOQA
8 except ImportError:
9 pass
10
11 from project.groups import DRH_NIVEAU_1, DRH_NIVEAU_2
12
13 PROJET_TITRE = "Ressources humaines"
14
15 # Rapports d'erreurs
16 SERVER_EMAIL = 'ne-pas-repondre@auf.org'
17 EMAIL_SUBJECT_PREFIX = '[auf_rh_dae - %s] ' % socket.gethostname()
18 ADMINS = ()
19
20 MANAGERS = ADMINS
21
22 TIME_ZONE = 'America/Montreal'
23 LANGUAGE_CODE = 'fr'
24 FORMAT_MODULE_PATH = 'project.formats'
25 USE_L10N = True
26 USE_THOUSAND_SEPARATOR = False
27 DATE_FORMAT = 'd-m-Y'
28 DATE_INPUT_FORMATS = ('%d-%m-%Y', )
29
30 SESSION_SAVE_EVERY_REQUEST = True
31 SESSION_EXPIRE_AT_BROWSER_CLOSE = True
32
33 PROJECT_ROOT = os.path.dirname(__file__)
34 SITE_ROOT = os.path.dirname(PROJECT_ROOT)
35
36 # Absolute path to the directory that holds media.
37 # Example: "/home/media/media.lawrence.com/"
38 MEDIA_ROOT = os.path.join(PROJECT_ROOT, 'media')
39 PRIVE_MEDIA_ROOT = os.path.join(PROJECT_ROOT, 'media_prive')
40
41 STATICFILES_DIRS = (
42 os.path.join(PROJECT_ROOT, 'assets'),
43 )
44 STATIC_ROOT = os.path.join(PROJECT_ROOT, 'static')
45 STATIC_URL = '/static/'
46
47 # URL that handles the media served from MEDIA_ROOT. Make sure to use a
48 # trailing slash if there is a path component (optional in other cases).
49 # Examples: "http://media.lawrence.com", "http://example.com/media/"
50 MEDIA_URL = '/media/'
51 PRIVE_MEDIA_URL = '/prive/'
52 OE_PRIVE_MEDIA_URL = '/recrutement/prive/'
53
54 # URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
55 # trailing slash.
56 # Examples: "http://foo.com/media/", "/media/".
57 #ADMIN_MEDIA_PREFIX = '/media/django/'
58
59 # Don't share this with anybody.
60 SECRET_KEY = '^2w#%abp_d+e#(7f5w$leef50)c@4y38cnn#ccji@84$2^rt#l'
61
62 MIDDLEWARE_CLASSES = (
63 'django.middleware.common.CommonMiddleware',
64 'django.contrib.sessions.middleware.SessionMiddleware',
65 'django.contrib.messages.middleware.MessageMiddleware',
66 'django.contrib.auth.middleware.AuthenticationMiddleware',
67 'auf.django.saml.middleware.SPMiddleware',
68 'auf.django.piwik.middleware.TrackMiddleware',
69 'django.middleware.doc.XViewMiddleware',
70 'reversion.middleware.RevisionMiddleware',
71 )
72
73 ROOT_URLCONF = 'project.urls'
74
75 INSTALLED_APPS = (
76 'auf.django.skin',
77 'auf.django.references',
78 'auf.django.emploi',
79 'auf.django.admingroup',
80 'auf.django.workflow',
81 'auf.django.permissions',
82 'auf.django.emploi',
83 'auf.django.saml',
84 'auf.django.pong',
85 'auf.django.export',
86 'admin_tools',
87 'admin_tools.theming',
88 'admin_tools.menu',
89 'admin_tools.dashboard',
90 'django.contrib.admin',
91 'django.contrib.auth',
92 'django.contrib.contenttypes',
93 'django.contrib.humanize',
94 'django.contrib.messages',
95 'django.contrib.sessions',
96 'django.contrib.staticfiles',
97 'django_qbe',
98 'ajax_select',
99 'south',
100 'raven.contrib.django',
101 'reversion',
102 'alphafilter',
103 'form_utils',
104 'tinymce',
105 'captcha',
106 'project.rh',
107 'project.dae',
108 'project.recrutement',
109 )
110
111 TEMPLATE_CONTEXT_PROCESSORS = (
112 'django.contrib.auth.context_processors.auth',
113 'django.core.context_processors.debug',
114 'django.core.context_processors.i18n',
115 'django.core.context_processors.media',
116 'django.core.context_processors.static',
117 'django.contrib.messages.context_processors.messages',
118 'django.core.context_processors.request',
119 'auf.django.skin.context_processors.auf',
120 'project.dae.context_processors.user_in_dae_groupes',
121 )
122
123 AUTHENTICATION_BACKENDS = (
124 'auf.django.saml.backends.SPBackend',
125 'auf.django.permissions.backends.AuthenticationBackend',
126 )
127
128 TEMPLATE_DIRS = (
129 os.path.join(os.path.dirname(__file__), "templates"),
130 )
131
132
133 ADMIN_TOOLS_INDEX_DASHBOARD = 'project.dashboard.CustomIndexDashboard'
134 ADMIN_TOOLS_APP_INDEX_DASHBOARD = 'project.dashboard.CustomAppIndexDashboard'
135 ADMIN_TOOLS_MENU = 'project.menu.CustomMenu'
136
137 AJAX_LOOKUP_CHANNELS = {
138 'responsables': ('project.dae.catalogues', 'Responsable'),
139 'dae_dossiers': ('project.dae.catalogues', 'Dossier'),
140 'dae_postes': ('project.dae.catalogues', 'Poste'),
141 'pays': ('project.rh.catalogues', 'Pays'),
142 'implantations': ('project.rh.catalogues', 'Implantation'),
143 'typepostes': ('project.rh.catalogues', 'TypePoste'),
144 'postes': ('project.rh.catalogues', 'Poste'),
145 'valeurpoints': ('project.rh.catalogues', 'ValeurPoint'),
146 'employes': ('project.rh.catalogues', 'Employe'),
147 'dossiers': ('project.rh.catalogues', 'Dossier'),
148 }
149 AJAX_SELECT_INLINES = 'inline'
150
151
152 TINYMCE_DEFAULT_CONFIG = {
153 'theme': "advanced",
154 'plugins': "paste",
155 'theme_advanced_buttons1': (
156 "bold,italic,underline,|,formatselect,|,bullist,numlist,|,undo,redo,|,"
157 "link,unlink"
158 ),
159 'theme_advanced_buttons2': "",
160 'theme_advanced_buttons3': "",
161 'theme_advanced_statusbar_location': "bottom",
162 'theme_advanced_toolbar_align': "left",
163 'theme_advanced_styles': "Titre=titre;Sous-titre=sous-titre;Normal=normal",
164 'width': "800",
165 'height': "200",
166 'theme_advanced_resizing': "true",
167 'custom_undo_redo_levels': 10,
168 'theme_advanced_toolbar_location': 'top',
169 'inline_styles': 'false',
170 'paste_use_dialog': 'false',
171 'paste_auto_cleanup_on_paste': 'true',
172 'paste_convert_headers_to_strong': 'false',
173 'paste_strip_class_attributes': 'all',
174 'paste_remove_spans': 'true',
175 'paste_remove_styles': 'true',
176 'content_css': '/media/css/tinymce.css',
177 }
178
179 # django-sendfile
180 SENDFILE_BACKEND = 'sendfile.backends.simple'
181
182 QBE_DISPLAY_DATABASES = False
183
184 # Il est *très* important de respecter la case.
185 QBE_CUSTOM_MODELS = {'Rh': {
186 'Employe': {},
187 'Poste': {},
188 'Dossier': {},
189 'Remuneration': {},
190 'Contrat': {},
191 }}
192
193 QBE_ALLOWED_FIELDS = {'Rh': {
194 'Employe': [
195 'nom', 'prenom', 'genre', 'date_naissance', 'situation_familiale',
196 'date_entree'
197 ],
198 'Poste': ['nom', 'date_debut', 'date_fin'],
199 'Dossier': [
200 'statut_residence', 'regime_travail',
201 'regime_travail_nb_heure_semaine', 'date_debut', 'date_fin'
202 ],
203 'Remuneration': ['montant', 'date_debut', 'date_fin'],
204 'Contrat': ['date_debut', 'date_fin'],
205 }}
206
207 SOUTH_TESTS_MIGRATE = False
208
209 LOGGING = {
210 'version': 1,
211 'disable_existing_loggers': True,
212 'root': {
213 'level': 'WARNING',
214 'handlers': ['sentry'],
215 },
216 'formatters': {
217 'verbose': {
218 'format': '%(levelname)s %(asctime)s %(module)s %(process)d %(thread)d %(message)s'
219 },
220 },
221 'handlers': {
222 'sentry': {
223 'level': 'WARNING',
224 'class': 'raven.contrib.django.handlers.SentryHandler',
225 },
226 'console': {
227 'level': 'DEBUG',
228 'class': 'logging.StreamHandler',
229 'formatter': 'verbose'
230 }
231 },
232 'loggers': {
233 'django.db.backends': {
234 'level': 'ERROR',
235 'handlers': ['console'],
236 'propagate': False,
237 },
238 'raven': {
239 'level': 'DEBUG',
240 'handlers': ['console'],
241 'propagate': False,
242 },
243 'sentry.errors': {
244 'level': 'DEBUG',
245 'handlers': ['console'],
246 'propagate': False,
247 },
248 },
249 }
250
251 CACHES = {
252 'default': {
253 'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
254 }
255 }
256
257 # Pour accéder aux requêtes savegardées, il faut définir les permissions dans
258 # l'admin
259 def qbe_access(user):
260 grps_user = [g.name for g in user.groups.all()]
261 inter = [g for g in grps_user if g in (DRH_NIVEAU_1, DRH_NIVEAU_2, )]
262 return len(inter) > 0
263 QBE_ACCESS_FOR = qbe_access