rapport contrats
[auf_rh_dae.git] / project / rh / views.py
1 # -*- encoding: utf-8 -*-
2
3 import urllib
4 from datetime import date
5 from itertools import izip
6 import StringIO
7
8 import pygraphviz as pgv
9
10 from django.core.urlresolvers import reverse
11 from django.db.models import Q
12 from django.utils.encoding import smart_str
13 from django.shortcuts import render_to_response, get_object_or_404
14 from django.template import RequestContext
15 from django.http import HttpResponse
16 from django import forms
17 from django.contrib.auth.decorators import login_required
18 from django.contrib.admin import widgets as adminwidgets
19 from django.core.servers.basehttp import FileWrapper
20
21 from datamaster_modeles import models as ref
22
23 from rh import models as rh
24 from rh.lib import calc_remun
25 from rh.decorators import drh_or_admin_required
26 from rh.templatetags.rapports import SortHeaders
27 from rh.change_list import RechercheTemporelle
28 from rh import graph as rh_graph
29 from rh.masse_salariale import MasseSalariale
30
31 # pas de reference a DAE devrait etre refactorisé
32 from dae.utils import get_employe_from_user
33 from dae.decorators import redirect_interdiction
34 from dae.workflow import grp_drh, grp_correspondants_rh
35 from django.conf import settings
36
37
38 @login_required
39 def profil(request):
40 """Profil personnel de l'employé - éditable"""
41 rc = RequestContext(request)
42 c = {}
43
44 employe = rc['this_employe']
45
46 c['user'] = request.user
47 c['employe'] = employe
48 return render_to_response('rh/profil.html', c, rc)
49
50
51 @login_required
52 def employes_liste(request):
53 """Liste des employés."""
54 today = date.today()
55 employes = rh.Employe.objects \
56 .exclude(dossiers__date_debut__gt=today) \
57 .exclude(dossiers__date_fin__lt=today) \
58 .order_by('nom')
59 c = {
60 'user': request.user,
61 'employes': employes,
62 }
63 return render_to_response('rh/employes_liste.html',
64 c,
65 RequestContext(request))
66
67
68 @login_required
69 def employe(request, id):
70 """Information publique sur un employé."""
71 try:
72 employe = rh.Employe.objects.get(pk=id)
73 except:
74 employe = rh.Employe.objects.none()
75 c = {
76 'user': request.user,
77 'employe': employe,
78 }
79 return render_to_response('rh/employe.html', c, RequestContext(request))
80
81
82 @login_required
83 @drh_or_admin_required
84 def rapports_poste(request):
85
86 lookup_params = dict(request.GET.items())
87
88 for key, value in lookup_params.items():
89 if key == 'o' or key == 'ot':
90 del lookup_params[key]
91 continue
92 if not isinstance(key, str):
93 # 'key' will be used as a keyword argument later, so Python
94 # requires it to be a string.
95 del lookup_params[key]
96 lookup_params[smart_str(key)] = value
97
98 if key == 'comble':
99 del lookup_params[key]
100
101 postes = rh.Poste.objects.select_related('implantation') \
102 .extra(select={'employe_id':'select group_concat(employe separator "|") from rh_dossier where poste=rh_poste.id and rh_dossier.date_fin is null %s' % \
103 ("%s" % (('order by employe %s' % ('asc' if 'ot' in request.GET and request.GET['ot'] == "asc" else "desc"))) if 'o' in request.GET and request.GET['o'] == "employe_id" else "") \
104 }) \
105 .extra(select={'employe_nom':'select group_concat(rh_employe.nom separator "|") from rh_dossier inner join rh_employe on rh_dossier.employe = rh_employe.id where poste=rh_poste.id and rh_dossier.date_fin is null %s' % \
106 ("%s" % (('order by rh_employe.nom %s' % ('asc' if 'ot' in request.GET and request.GET['ot'] == "asc" else "desc"))) if 'o' in request.GET and request.GET['o'] == "employe_nom" else "") \
107 }) \
108 .extra(select={'employe_prenom':'select group_concat(rh_employe.prenom separator "|") from rh_dossier inner join rh_employe on rh_dossier.employe = rh_employe.id where poste=rh_poste.id and rh_dossier.date_fin is null %s' % \
109 ("%s" % (('order by rh_employe.prenom %s' % ('asc' if 'ot' in request.GET and request.GET['ot'] == "asc" else "desc"))) if 'o' in request.GET and request.GET['o'] == "employe_prenom" else "") \
110 })
111
112 postes = postes.filter(**lookup_params)
113 if 'o' in request.GET:
114 postes = postes.order_by("%s%s" % ('-' if 'ot' in request.GET and request.GET['ot'] == "desc" else '', request.GET['o']))
115
116 out = []
117 for p in postes:
118 out.append({
119 'id': p.id,
120 'nom': p.nom,
121 'implantation': p.implantation,
122 'employes': [] if not p.employe_id else [{'id': id, 'nom': nom, 'prenom': prenom} for id, nom, prenom in izip(p.employe_id.split('|'), p.employe_nom.split('|'), p.employe_prenom.split('|'))] })
123
124
125 headers = [
126 ("id", u"# du poste"),
127 ("nom", u"Nom du poste"),
128 ("implantation__id", u"Implantation"),
129 ("employe_nom", u"Nom"),
130 ]
131 h = SortHeaders(request, headers, order_field_type="ot", order_field="o")
132 c = {
133 'title': 'Rapport des postes',
134 'postes': out,
135 'count': len(out),
136 'headers': list(h.headers()),
137 }
138
139 return render_to_response('rh/rapports/postes.html', c, RequestContext(request))
140
141 @login_required
142 @drh_or_admin_required
143 def rapports_contrat(request):
144 if 'HTTP_REFERER' in request.META.keys():
145 referer = request.META['HTTP_REFERER']
146 referer = "/".join(referer.split('/')[3:])
147 referer = "/%s" % referer.split('?')[0]
148 if referer != reverse('rhr_contrats'):
149 params = request.GET.copy()
150 params.update({'statut': 'Actif'})
151 request.GET = params
152
153 lookup_params = dict(request.GET.items())
154 if 'ot' in lookup_params:
155 del lookup_params['ot']
156 if 'o' in lookup_params:
157 del lookup_params['o']
158
159 for key, value in lookup_params.items():
160 if not isinstance(key, str):
161 # 'key' will be used as a keyword argument later, so Python
162 # requires it to be a string.
163 del lookup_params[key]
164 lookup_params[smart_str(key)] = value
165
166 contrats = rh.Contrat.objects.select_related('dossier', 'dossier__poste', 'dossier__poste__implantation', 'type_contrat', 'dossier__employe')
167
168 cl = RechercheTemporelle(dict(request.GET.items()), rh.Contrat)
169 lookup_params = cl.purge_params(lookup_params)
170 q_temporel = cl.get_q_temporel(contrats)
171 q = Q(**lookup_params) & q_temporel
172 contrats = contrats.filter(q).exclude(dossier__employe__supprime=1)
173
174 if 'o' in request.GET:
175 contrats = contrats.order_by("%s%s" % ('-' if 'ot' in request.GET and request.GET['ot'] == "desc" else '', request.GET['o']))
176
177 employes = set([c.dossier.employe_id for c in contrats])
178
179 headers = [
180 ("dossier__employe__id", u"# de l'employé"),
181 ("dossier__employe__nom", u"Employé"),
182 ("type_contrat__nom", u"Poste"),
183 ("dossier__poste__implantation__region", u"Région"),
184 ("dossier__poste__implantation", u"Implantation"),
185 ("type_contrat__nom", u"Type de contrat"),
186 ("date_debut", u"Date début"),
187 ("date_fin", u"Date fin"),
188 ]
189 h = SortHeaders(request, headers, order_field_type="ot", order_field="o")
190
191 c = {
192 'cl' : cl,
193 'title': 'Rapport des contrats',
194 'contrats': contrats,
195 'count': len(contrats),
196 'count_employe' : len(employes),
197 'headers': list(h.headers()),
198 }
199
200 return render_to_response('rh/rapports/contrats.html', c, RequestContext(request))
201
202
203 @login_required
204 @drh_or_admin_required
205 def rapports_masse_salariale(request):
206
207 class RechercheTemporelle(forms.Form):
208 CHOICE_ANNEES = range(
209 rh.Remuneration.objects.exclude(date_debut=None) \
210 .order_by('date_debut')[0].date_debut.year
211 , date.today().year + 1)
212
213 annee = forms.CharField(initial=date.today().year,
214 widget=forms.Select(choices=
215 ((a, a) for a in reversed(CHOICE_ANNEES)
216 ))
217 )
218
219 region = forms.CharField(
220 widget=forms.Select(choices=[('', '')] +
221 [(i.id, i) for i in ref.Region.objects.all()]
222 )
223 )
224
225 implantation = forms.CharField(
226 widget=forms.Select(choices=[('', '')] +
227 [(i.id, i) for i in ref.Implantation.objects.all()]
228 )
229 )
230
231 #date_debut = forms.DateField(widget=adminwidgets.AdminDateWidget)
232 #date_fin = forms.DateField(widget=adminwidgets.AdminDateWidget)
233
234
235 form = RechercheTemporelle(request.GET)
236 get_filtre = [(k, v) for k,v in request.GET.items() \
237 if k not in ('date_debut', 'date_fin', 'implantation', )]
238 query_string = urllib.urlencode(get_filtre)
239
240 date_debut = None
241 date_fin = None
242 if request.GET.get('annee', None):
243 date_debut = "01-01-%s" % request.GET.get('annee', None)
244 date_fin = "31-12-%s" % request.GET.get('annee', None)
245
246 implantation = request.GET.get('implantation')
247 region = request.GET.get('region')
248
249 custom_filter = {}
250 if implantation:
251 custom_filter['dossier__poste__implantation'] = implantation
252 if region:
253 custom_filter['dossier__poste__implantation__region'] = region
254
255 c = {
256 'title': 'Rapport de masse salariale',
257 'form': form,
258 'headers': [],
259 'query_string': query_string,
260 }
261 if date_debut or date_fin:
262 masse = MasseSalariale(date_debut, date_fin, custom_filter,
263 request.GET.get('ne_pas_grouper', False))
264 if masse.rapport:
265 if request.GET.get('ods'):
266 for h in (h for h in masse.headers if 'background-color' in h[2]):
267 del h[2]['background-color']
268 masse.ods()
269 output = StringIO.StringIO()
270 masse.doc.save(output)
271 output.seek(0)
272
273 response = HttpResponse(FileWrapper(output), content_type=
274 'application/vnd.oasis.opendocument.spreadsheet')
275 response['Content-Disposition'] = \
276 'attachment; filename=Masse Salariale %s.ods' % \
277 masse.annee
278 return response
279 else:
280 c['rapport'] = masse.rapport
281 c['header_keys'] = [h[0] for h in masse.headers]
282 #on enleve le background pour le header
283 for h in (h for h in masse.headers if 'background-color' in h[2]):
284 h[2]['background'] = 'none'
285 h = SortHeaders(request, masse.headers, order_field_type="ot",
286 not_sortable=c['header_keys'], order_field="o")
287 c['headers'] = list(h.headers())
288 for key, nom, opts in masse.headers:
289 c['headers']
290 c['total'] = masse.grand_totaux[0]
291 c['total_euro'] = masse.grand_totaux[1]
292 c['colspan'] = len(c['header_keys']) - 1
293 get_filtre.append(('ods', True))
294 query_string = urllib.urlencode(get_filtre)
295 c['url_ods'] = "%s?%s" % (
296 reverse('rhr_masse_salariale'), query_string)
297
298 return render_to_response('rh/rapports/masse_salariale.html', c, RequestContext(request))
299
300
301 @login_required
302 @drh_or_admin_required
303 def rapports_remuneration(request):
304
305 lookup_params = dict(request.GET.items())
306 if 'ot' in lookup_params:
307 del lookup_params['ot']
308 if 'o' in lookup_params:
309 del lookup_params['o']
310
311 for key, value in lookup_params.items():
312 if not isinstance(key, str):
313 # 'key' will be used as a keyword argument later, so Python
314 # requires it to be a string.
315 del lookup_params[key]
316 lookup_params[smart_str(key)] = value
317
318 employes = rh.Employe.objects.all()
319 if 'o' in request.GET:
320 employes = employes.order_by("%s%s" % ('-' if 'ot' in request.GET and request.GET['ot'] == "desc" else '', request.GET['o']))
321
322 employes = employes.filter(**lookup_params)
323
324 output = []
325 headers = [
326 ("id", u"# de l'employé"),
327 ("nom", u"Nom"),
328 ("prenom", u"Prénom"),
329 ("", u"Salaire"),
330 ("", u"RAS"),
331 ("", u"Indemnités"),
332 ("", u"Accessoire"),
333 ("", u"Charges patronales"),
334 ("", u"Total"),
335 ]
336 h = SortHeaders(request, headers, order_field_type="ot", order_field="o")
337
338 for employe in employes:
339 line = {}
340 output.append(line)
341
342 dossiers = employe.rh_dossiers.all()
343
344 remun = {}
345 remun_sum_euro = 0
346
347 for dossier in dossiers:
348 this_remun, this_remun_sum, this_remun_sum_euro = calc_remun(dossier)
349
350 for item in this_remun:
351 if item not in remun:
352 remun[item] = this_remun[item]
353 else:
354 remun[item][0] += this_remun[item][0]
355 remun[item][1] += this_remun[item][1]
356
357 remun_sum_euro += this_remun_sum_euro
358
359 line['remun_sum_euro'] = remun_sum_euro
360
361 for r in remun:
362 if r == u'Indemnité':
363 line['Indemnite'] = remun[r][1]
364 else:
365 line[r] = remun[r][1]
366
367 line['id'] = employe.id
368 line['nom'] = employe.nom
369 line['prenom'] = employe.prenom
370
371
372 c = {
373 'title': 'Rapport de remuneration',
374 'employes': output,
375 'headers': list(h.headers()),
376 }
377
378 return render_to_response('rh/rapports/remuneration.html', c, RequestContext(request))
379
380 @login_required
381 @drh_or_admin_required
382 def rapports_employe_sans_contrat(request):
383
384 lookup_params = dict(request.GET.items())
385 if 'ot' in lookup_params:
386 del lookup_params['ot']
387 if 'o' in lookup_params:
388 del lookup_params['o']
389
390 for key, value in lookup_params.items():
391 if not isinstance(key, str):
392 # 'key' will be used as a keyword argument later, so Python
393 # requires it to be a string.
394 del lookup_params[key]
395 lookup_params[smart_str(key)] = value
396
397 employes_query = rh.Employe.objects
398 if 'o' in request.GET:
399 employes_query = employes_query.order_by("%s%s" % ('-' if 'ot' in request.GET and request.GET['ot'] == "desc" else '', request.GET['o']))
400
401 employes = {}
402
403 dossiers_en_cours = rh.Dossier.objects.filter(Q(date_fin=None) | Q(date_fin__gt=date.today()))
404 tous_contrats_echus = rh.Contrat.objects.filter(date_fin__lt=date.today(), dossier__in=dossiers_en_cours)
405 contrats = tous_contrats_echus.filter(**lookup_params).all()
406 for c in contrats:
407 if c.dossier.employe.id not in employes.keys():
408 employes[c.dossier.employe.id] = {'employe': c.dossier.employe, 'dossiers': []}
409 employes[c.dossier.employe.id]['dossiers'] += [c.dossier,]
410
411
412
413 headers = [
414 ("id", u"# de l'employé"),
415 ("nom", u"Nom"),
416 ("prenom", u"Prénom"),
417 ("dossier", u"Dossiers"),
418 ]
419 h = SortHeaders(request, headers, order_field_type="ot", order_field="o", not_sortable=('dossier',))
420
421 c = {
422 'title': u'Rapport des employés sans contrat',
423 'employes': employes,
424 'count': len(employes),
425 'headers': list(h.headers()),
426 }
427
428 return render_to_response('rh/rapports/employes_sans_contrat.html', c, RequestContext(request))
429
430 @login_required
431 @drh_or_admin_required
432 def rapports_postes_modelisation(request):
433 c = {}
434 data = []
435
436 for f in rh.FamilleEmploi.objects.all():
437 types = rh.TypePoste.objects.filter(famille_emploi=f)
438 data_types = []
439 for t in types.all():
440 postes = rh.Poste.objects.filter(type_poste=t)
441 data_types.append({
442 'num_postes': postes.count(),
443 'postes': postes.all(),
444 'type': f,
445 })
446
447 data.append({
448 'famille': f,
449 'nb_types': types.count(),
450 'types' : data_types
451 })
452
453 c['data'] = data
454
455
456 return render_to_response('rh/rapports/postes_modelisation.html', c, RequestContext(request))
457
458
459 @login_required
460 @drh_or_admin_required
461 def rapports_postes_implantation(request):
462 c = {}
463 data = []
464 for r in ref.Region.objects.all():
465 implantations = []
466 for i in ref.Implantation.objects.filter(region=r):
467 implantations.append({
468 'implantation': i,
469 'postes': rh.Poste.objects.filter(implantation=i),
470 'num_postes': rh.Poste.objects.filter(implantation=i).count(),
471 })
472 data.append({
473 'region': r,
474 'implantations': implantations
475 })
476
477 c['data'] = data
478
479
480 return render_to_response('rh/rapports/postes_implantation.html', c, RequestContext(request))
481
482
483 @login_required
484 @drh_or_admin_required
485 def rapports_postes_service(request):
486 c = {}
487 data = []
488 for s in rh.Service.objects.all():
489 postes = rh.Poste.objects.filter(service=s).all()
490 num_postes = rh.Poste.objects.filter(service=s).count()
491 data.append({'service': s, 'num_postes': num_postes, 'postes': postes})
492
493 c['data'] = data
494 return render_to_response('rh/rapports/postes_service.html', c, RequestContext(request))
495
496
497 def region_protected(model):
498 def wrapper(func):
499 def wrapped(request, id):
500 if request.user.is_superuser:
501 return func(request, id)
502 user_groups = request.user.groups.all()
503 if grp_drh in user_groups:
504 return func(request, id)
505 if grp_correspondants_rh in user_groups:
506 employe = get_employe_from_user(request.user)
507 q = Q(**{model.prefix_implantation: employe.implantation.region})
508 qs = model.objects.filter(q)
509 if int(id) in [o.id for o in qs]:
510 return func(request, id)
511 return redirect_interdiction(request)
512 return wrapped
513 return wrapper
514
515
516 @region_protected(rh.Dossier)
517 def dossier_apercu(request, dossier_id):
518 d = get_object_or_404(rh.Dossier, pk=dossier_id)
519 c = {
520 'title': u"Dossier %s" % (d, ),
521 'is_popup' : request.GET.get('_popup', False),
522 'dossier' : d,
523 'pieces' : rh.DossierPiece.objects.filter(dossier__exact=d),
524 'contrats' : rh.Contrat.objects.filter(dossier__exact=d),
525 'commentaires' : rh.DossierCommentaire.objects.filter(dossier__exact=d).all(),
526 'media_url': settings.PRIVE_MEDIA_URL,
527 }
528 return render_to_response('admin/rh/dossier/apercu.html', c, RequestContext(request))
529
530 @region_protected(rh.Poste)
531 def poste_apercu(request, poste_id):
532 p = get_object_or_404(rh.Poste, pk=poste_id)
533 c = {
534 'title': u"Poste %s" % (p, ),
535 'is_popup' : request.GET.get('_popup', False),
536 'poste' : p,
537 'financements' : rh.PosteFinancement.objects.filter(poste=poste_id).all(),
538 'pieces' : rh.PostePiece.objects.filter(poste=poste_id).all(),
539 'dossiers' : rh.Dossier.objects.filter(poste=poste_id).order_by("-date_debut").all(),
540 'comparaisons' : rh.PosteComparaison.objects.filter(poste=poste_id).all(),
541 'commentaires' : rh.PosteCommentaire.objects.filter(poste=poste_id).all(),
542 'media_url': settings.PRIVE_MEDIA_URL,
543 }
544 return render_to_response('admin/rh/poste/apercu.html', c, RequestContext(request))
545
546 def employe_apercu(request, employe_id):
547 employe = get_object_or_404(rh.Employe, pk=employe_id)
548 user_groups = request.user.groups.all()
549 dossiers = None
550
551 if request.user.is_superuser or \
552 grp_drh in user_groups:
553 q = Q(employe=employe)
554 if grp_correspondants_rh in user_groups:
555 regions = [d.poste.implantation.region for d in employe.rh_dossiers.all()]
556 q = Q(employe=employe) & Q(implantation__region__in=regions)
557
558 dossiers = rh.Dossier.objects.filter(q).order_by('-date_debut')
559
560 c = {
561 'title': u"Employe %s" % (employe, ),
562 'is_popup' : request.GET.get('_popup', False),
563 'employe' : employe,
564 'dossiers' : dossiers,
565 'media_url': settings.PRIVE_MEDIA_URL,
566 }
567 return render_to_response('admin/rh/employe/apercu.html', c, RequestContext(request))
568
569 @login_required
570 @drh_or_admin_required
571 def organigrammes_employe(request, id, level="all"):
572
573 poste = get_object_or_404(rh.Poste, pk=id)
574 dossiers_by_poste = dict((d.poste_id, d) for d in rh.Dossier.objects.select_related('employe', 'poste').all())
575 postes_by_id = dict((p.id, p) for p in rh.Poste.objects.all())
576
577 e = dossiers_by_poste[poste.id].employe
578 name = u"Organigramme de [%s] %s %s" % (e.id, e.nom.upper(), e.prenom)
579 graph = pgv.AGraph()
580
581 if rh.Poste.objects.filter(responsable=poste).count() > 0:
582 postes_handle = [poste]
583 while postes_handle:
584 postes_handle = rh.Poste.objects.select_related('implantation').filter((Q(date_fin__gt=date.today()) | Q(date_fin=None)) & (Q(date_debut__lt=date.today()) | Q(date_debut=None)) ).filter(responsable__in=postes_handle).exclude(supprime=True).exclude(responsable=None).all()
585
586 for p in postes_handle:
587 if p.responsable_id != p.id:
588 graph.add_edge(dossiers_by_poste[p.responsable_id].poste_id, p.id)
589
590 else:
591 graph.add_node(poste.id)
592
593 if level != "all":
594 postes_niveau = [poste.id]
595 for niveau in range(int(level)):
596 postes_niveau = [p.id for p in rh.Poste.objects.filter(responsable__in=postes_niveau).all()]
597
598 while postes_niveau:
599 postes_niveau = [p.id for p in rh.Poste.objects.filter(responsable__in=postes_niveau).all()]
600 if postes_niveau:
601 for p in postes_niveau:
602 if graph.has_node(p):
603 graph.delete_node(p)
604
605 a = graph
606 a.name = name.encode('ascii', 'xmlcharrefreplace')
607
608 poste_remontant = poste
609 while poste_remontant.responsable_id:
610 a.add_edge(poste_remontant.responsable_id, poste_remontant.id)
611 poste_remontant = poste_remontant.responsable
612
613 rh_graph.bind_poste_to_graph(a, postes_by_id)
614 #a.graph_attr['normalize'] = True
615 #a.graph_attr['level'] = 2
616 a.layout(prog='dot')
617
618 svg = a.draw(format='svg')
619
620 c = {
621 'svg': svg
622 }
623
624 if 'forcer' in request.GET:
625 response = HttpResponse(svg, mimetype='image/svg+xml')
626 response['Content-Disposition'] = 'attachment; filename=organigramme.svg'
627 return response
628
629 return render_to_response('rh/organigrammes/employe.html', c, RequestContext(request), mimetype="image/svg+xml")
630
631
632 @login_required
633 @drh_or_admin_required
634 def organigrammes_service(request, id):
635
636 service = get_object_or_404(rh.Service, pk=id)
637 svg = rh_graph.organigramme_postes_cluster( \
638 cluster_filter={"service": service}, \
639 titre=u"Organigramme du service %s" % service.nom,
640 cluster_titre=service.nom)
641
642 c = {
643 'svg': svg
644 }
645
646 return render_to_response('rh/organigrammes/vide.html', c, RequestContext(request), mimetype="image/svg+xml")
647
648 @login_required
649 @drh_or_admin_required
650 def organigrammes_implantation(request, id):
651
652 implantation = get_object_or_404(ref.Implantation, pk=id)
653 svg = rh_graph.organigramme_postes_cluster( \
654 cluster_filter={"implantation": implantation}, \
655 titre=u"Organigramme de l'implantation %s" % implantation.nom,
656 cluster_titre=implantation.nom)
657
658 c = {
659 'svg': svg
660 }
661
662 return render_to_response('rh/organigrammes/vide.html', c, RequestContext(request), mimetype="image/svg+xml")
663
664 @login_required
665 @drh_or_admin_required
666 def organigrammes_region(request, id):
667
668 region = get_object_or_404(ref.Region, pk=id)
669 svg = rh_graph.organigramme_postes_cluster( \
670 cluster_filter={"implantation__region": region}, \
671 titre=u"Organigramme du bureau de %s" % region.nom,
672 cluster_titre=region.nom)
673
674 c = {
675 'svg': svg
676 }
677
678 return render_to_response('rh/organigrammes/vide.html', c, RequestContext(request), mimetype="image/svg+xml")