eb985d65956b53dd34a60a15cc03c110c222e170
[auf_rh_dae.git] / project / settings.py
1 # -*- encoding: utf-8 -*-
2
3 import os
4 import socket
5 from project.conf import * # NOQA
6 from project.groups import DRH_NIVEAU_1, DRH_NIVEAU_2
7
8 PROJET_TITRE = "Ressources humaines"
9
10 # Rapports d'erreurs
11 SERVER_EMAIL = 'ne-pas-repondre@auf.org'
12 EMAIL_SUBJECT_PREFIX = '[auf_rh_dae - %s] ' % socket.gethostname()
13 ADMINS = ()
14
15 MANAGERS = ADMINS
16
17 TIME_ZONE = 'America/Montreal'
18 LANGUAGE_CODE = 'fr'
19 FORMAT_MODULE_PATH = 'project.formats'
20 USE_L10N = True
21 USE_THOUSAND_SEPARATOR = False
22 DATE_FORMAT = 'd-m-Y'
23 DATE_INPUT_FORMATS = ('%d-%m-%Y', )
24
25 SESSION_SAVE_EVERY_REQUEST = True
26 SESSION_EXPIRE_AT_BROWSER_CLOSE = True
27
28 PROJECT_ROOT = os.path.dirname(__file__)
29 SITE_ROOT = os.path.dirname(PROJECT_ROOT)
30
31 # Absolute path to the directory that holds media.
32 # Example: "/home/media/media.lawrence.com/"
33 MEDIA_ROOT = os.path.join(PROJECT_ROOT, 'media')
34 PRIVE_MEDIA_ROOT = os.path.join(PROJECT_ROOT, 'media_prive')
35
36 STATICFILES_DIRS = (
37 os.path.join(PROJECT_ROOT, 'assets'),
38 )
39 STATIC_ROOT = os.path.join(PROJECT_ROOT, 'static')
40 STATIC_URL = '/static/'
41
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/"
45 MEDIA_URL = '/media/'
46 PRIVE_MEDIA_URL = '/prive/'
47 OE_PRIVE_MEDIA_URL = '/recrutement/prive/'
48
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/".
52 #ADMIN_MEDIA_PREFIX = '/media/django/'
53
54 # Don't share this with anybody.
55 SECRET_KEY = '^2w#%abp_d+e#(7f5w$leef50)c@4y38cnn#ccji@84$2^rt#l'
56
57 MIDDLEWARE_CLASSES = (
58 'django.middleware.common.CommonMiddleware',
59 'django.contrib.sessions.middleware.SessionMiddleware',
60 'django.contrib.messages.middleware.MessageMiddleware',
61 'django.contrib.auth.middleware.AuthenticationMiddleware',
62 'auf.django.saml.middleware.SPMiddleware',
63 'auf.django.piwik.middleware.TrackMiddleware',
64 'django.middleware.doc.XViewMiddleware',
65 'reversion.middleware.RevisionMiddleware',
66 )
67
68 ROOT_URLCONF = 'project.urls'
69
70 INSTALLED_APPS = (
71 'auf.django.skin',
72 'auf.django.references',
73 'auf.django.emploi',
74 'auf.django.admingroup',
75 'auf.django.workflow',
76 'auf.django.permissions',
77 'auf.django.emploi',
78 'auf.django.saml',
79 'auf.django.pong',
80 'auf.django.export',
81 'admin_tools',
82 'admin_tools.theming',
83 'admin_tools.menu',
84 'admin_tools.dashboard',
85 'django.contrib.admin',
86 'django.contrib.auth',
87 'django.contrib.contenttypes',
88 'django.contrib.humanize',
89 'django.contrib.messages',
90 'django.contrib.sessions',
91 'django.contrib.staticfiles',
92 'django_qbe',
93 'ajax_select',
94 'south',
95 'raven.contrib.django',
96 'reversion',
97 'alphafilter',
98 'form_utils',
99 'tinymce',
100 'captcha',
101 'project.rh',
102 'project.dae',
103 'project.recrutement',
104 )
105
106 TEMPLATE_CONTEXT_PROCESSORS = (
107 'django.contrib.auth.context_processors.auth',
108 'django.core.context_processors.debug',
109 'django.core.context_processors.i18n',
110 'django.core.context_processors.media',
111 'django.core.context_processors.static',
112 'django.contrib.messages.context_processors.messages',
113 'django.core.context_processors.request',
114 'auf.django.skin.context_processors.auf',
115 'project.dae.context_processors.user_in_dae_groupes',
116 )
117
118 AUTHENTICATION_BACKENDS = (
119 'auf.django.saml.backends.SPBackend',
120 'auf.django.permissions.backends.AuthenticationBackend',
121 )
122
123 TEMPLATE_DIRS = (
124 os.path.join(os.path.dirname(__file__), "templates"),
125 )
126
127
128 ADMIN_TOOLS_INDEX_DASHBOARD = 'project.dashboard.CustomIndexDashboard'
129 ADMIN_TOOLS_APP_INDEX_DASHBOARD = 'project.dashboard.CustomAppIndexDashboard'
130 ADMIN_TOOLS_MENU = 'project.menu.CustomMenu'
131
132 AJAX_LOOKUP_CHANNELS = {
133 'responsables': ('project.dae.catalogues', 'Responsable'),
134 'dae_dossiers': ('project.dae.catalogues', 'Dossier'),
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'),
143 }
144 AJAX_SELECT_INLINES = 'inline'
145
146
147 TINYMCE_DEFAULT_CONFIG = {
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',
172 }
173
174 # django-sendfile
175 SENDFILE_BACKEND = 'sendfile.backends.simple'
176
177 QBE_DISPLAY_DATABASES = False
178
179 # Il est *très* important de respecter la case.
180 QBE_CUSTOM_MODELS = {'Rh': {
181 'Employe': {},
182 'Poste': {},
183 'Dossier': {},
184 'Remuneration': {},
185 'Contrat': {},
186 }}
187
188 QBE_ALLOWED_FIELDS = {'Rh': {
189 'Employe': [
190 'nom', 'prenom', 'genre', 'date_naissance', 'situation_familiale',
191 'date_entree'
192 ],
193 'Poste': ['nom', 'date_debut', 'date_fin'],
194 'Dossier': [
195 'statut_residence', 'regime_travail',
196 'regime_travail_nb_heure_semaine', 'date_debut', 'date_fin'
197 ],
198 'Remuneration': ['montant', 'date_debut', 'date_fin'],
199 'Contrat': ['date_debut', 'date_fin'],
200 }}
201
202 SOUTH_TESTS_MIGRATE = False
203
204 LOGGING = {
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 }
245
246 CACHES = {
247 'default': {
248 'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
249 }
250 }
251
252 # Pour accéder aux requêtes savegardées, il faut définir les permissions dans
253 # l'admin
254 def qbe_access(user):
255 grps_user = [g.name for g in user.groups.all()]
256 inter = [g for g in grps_user if g in (DRH_NIVEAU_1, DRH_NIVEAU_2, )]
257 return len(inter) > 0
258 QBE_ACCESS_FOR = qbe_access