page perso rh.Employe couvert
[auf_rh_dae.git] / project / rh / views.py
CommitLineData
e9bbd6ba 1# -*- encoding: utf-8 -*-
3411ac33 2from django.contrib.auth.decorators import login_required
e9bbd6ba 3from django.shortcuts import redirect, render_to_response, get_object_or_404
4from django.template import RequestContext
5
d04d084c 6from datamaster_modeles import models as ref
3411ac33 7from project.decorators import user_is_this_employe
d04d084c 8from project.lib import get_employe_from_id
ae936f8d 9
d04d084c 10from rh import models as rh
a9faef67 11
3411ac33 12# homes
13@user_is_this_employe
a9faef67 14def perso(request, id):
15 """Espace personnel de l'employé."""
d04d084c 16 employe = get_employe_from_id(id)
17
a9faef67 18 c = {
19 'user':request.user,
20 'employe':employe,
21 }
22 return render_to_response('rh/perso.html', c, RequestContext(request))
23
24# employes
3411ac33 25@login_required
a9faef67 26def employes_liste(request):
27 """Liste des employés."""
28 employes = rh.Employe.objects.all()
29 c = {
30 'user':request.user,
31 'employes':employes,
32 }
33 return render_to_response('rh/employes_liste.html', c, RequestContext(request))
34
3411ac33 35@login_required
a9faef67 36def employe(request, id):
37 """Information publique sur un employé."""
38 try:
39 employe = rh.Employe.objects.get(pk=id)
40 except:
41 employe = rh.Employe.objects.none()
42 c = {
43 'user':request.user,
44 'employe':employe,
45 }
46 return render_to_response('rh/employe.html', c, RequestContext(request))