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