Changements au buildout + settings pour me permettre de builder le projet
[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',
17353922 101 'reversion',
7ffc5aa4 102 'alphafilter',
8ea41642 103 'form_utils',
ec517164 104 'tinymce',
86caaf03 105 'captcha',
0c104342
DB
106 'project.rh',
107 'project.dae',
108 'project.recrutement',
5e23d90d
OL
109)
110
111TEMPLATE_CONTEXT_PROCESSORS = (
4229d916 112 'django.contrib.auth.context_processors.auth',
5e23d90d
OL
113 'django.core.context_processors.debug',
114 'django.core.context_processors.i18n',
115 'django.core.context_processors.media',
63f8af95 116 'django.core.context_processors.static',
5e23d90d
OL
117 'django.contrib.messages.context_processors.messages',
118 'django.core.context_processors.request',
119 'auf.django.skin.context_processors.auf',
ef71b858 120 'project.dae.context_processors.user_in_dae_groupes',
5e23d90d
OL
121)
122
8846b99e 123AUTHENTICATION_BACKENDS = (
b1b7cca2 124 'auf.django.saml.backends.SPBackend',
c3f0b49f 125 'auf.django.permissions.backends.AuthenticationBackend',
8846b99e 126)
5e23d90d 127
5e23d90d
OL
128TEMPLATE_DIRS = (
129 os.path.join(os.path.dirname(__file__), "templates"),
130)
131
132
8846b99e 133ADMIN_TOOLS_INDEX_DASHBOARD = 'project.dashboard.CustomIndexDashboard'
7f43054e 134ADMIN_TOOLS_APP_INDEX_DASHBOARD = 'project.dashboard.CustomAppIndexDashboard'
6f38ca31 135ADMIN_TOOLS_MENU = 'project.menu.CustomMenu'
3121c13c
OL
136
137AJAX_LOOKUP_CHANNELS = {
294866db 138 'responsables': ('project.dae.catalogues', 'Responsable'),
05f7e241 139 'dae_dossiers': ('project.dae.catalogues', 'Dossier'),
294866db
EMS
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'),
3121c13c 148}
105dd778
OL
149AJAX_SELECT_INLINES = 'inline'
150
8ea41642 151
ec517164 152TINYMCE_DEFAULT_CONFIG = {
294866db
EMS
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',
ec517164 177}
34dad720
EMS
178
179# django-sendfile
34dad720 180SENDFILE_BACKEND = 'sendfile.backends.simple'
361d53e1
PP
181
182QBE_DISPLAY_DATABASES = False
ddf236b3
PP
183
184# Il est *très* important de respecter la case.
185QBE_CUSTOM_MODELS = {'Rh': {
186 'Employe': {},
187 'Poste': {},
188 'Dossier': {},
189 'Remuneration': {},
190 'Contrat': {},
191}}
972e7cf1
PP
192
193QBE_ALLOWED_FIELDS = {'Rh': {
294866db
EMS
194 'Employe': [
195 'nom', 'prenom', 'genre', 'date_naissance', 'situation_familiale',
196 'date_entree'
197 ],
972e7cf1 198 'Poste': ['nom', 'date_debut', 'date_fin'],
294866db
EMS
199 'Dossier': [
200 'statut_residence', 'regime_travail',
201 'regime_travail_nb_heure_semaine', 'date_debut', 'date_fin'
202 ],
972e7cf1
PP
203 'Remuneration': ['montant', 'date_debut', 'date_fin'],
204 'Contrat': ['date_debut', 'date_fin'],
205}}
82c5e37d 206
d7bf0cd3 207SOUTH_TESTS_MIGRATE = False
a6197482
OL
208
209LOGGING = {
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}
31e71fb6 250
9daa9f48
OL
251CACHES = {
252 'default': {
253 'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
254 }
255}
256
31e71fb6
OL
257# Pour accéder aux requêtes savegardées, il faut définir les permissions dans
258# l'admin
259def 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
263QBE_ACCESS_FOR = qbe_access