profil : ajout champs remun
[auf_rh_dae.git] / project / rh / views.py
CommitLineData
e9bbd6ba 1# -*- encoding: utf-8 -*-
c9122f1d 2from datetime import date
9b0a8554 3
3411ac33 4from django.contrib.auth.decorators import login_required
e9bbd6ba 5from django.shortcuts import redirect, render_to_response, get_object_or_404
6from django.template import RequestContext
7
d04d084c 8from datamaster_modeles import models as ref
d04d084c 9from project.lib import get_employe_from_id
ae936f8d 10
d04d084c 11from rh import models as rh
a9faef67 12
3411ac33 13# homes
c9122f1d 14@login_required
15def profil(request):
16 """Profil personnel de l'employé - éditable"""
17 rc = RequestContext(request)
18 c = {}
d04d084c 19
c9122f1d 20 employe = rc['this_employe']
65f9fac8 21
c9122f1d 22 c['user'] = request.user
23 c['employe'] = employe
c9122f1d 24 return render_to_response('rh/profil.html', c, rc)
a9faef67 25
26# employes
3411ac33 27@login_required
a9faef67 28def employes_liste(request):
29 """Liste des employés."""
5ea6b5bb 30 today = date.today()
31 employes = rh.Employe.objects \
32 .filter(actif=True, supprime=False) \
33 .filter(dossiers__actif=True, dossiers__supprime=False) \
34 .exclude(dossiers__date_debut__gt=today) \
35 .exclude(dossiers__date_fin__lt=today) \
36 .order_by('nom')
a9faef67 37 c = {
38 'user':request.user,
39 'employes':employes,
40 }
41 return render_to_response('rh/employes_liste.html', c, RequestContext(request))
42
3411ac33 43@login_required
a9faef67 44def employe(request, id):
45 """Information publique sur un employé."""
46 try:
47 employe = rh.Employe.objects.get(pk=id)
48 except:
49 employe = rh.Employe.objects.none()
50 c = {
51 'user':request.user,
52 'employe':employe,
53 }
54 return render_to_response('rh/employe.html', c, RequestContext(request))