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