refact ergo + page perso (vide)
[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
a9faef67 6#from datamaster_modeles import models as ref
e9bbd6ba 7from project.rh import models as rh
3411ac33 8from project.decorators import user_is_this_employe
ae936f8d 9
a9faef67 10
3411ac33 11# homes
12@user_is_this_employe
a9faef67 13def perso(request, id):
14 """Espace personnel de l'employé."""
15 try:
16 employe = rh.Employe.objects.get(pk=id)
17 except:
18 employe = rh.Employe.none()
19 c = {
20 'user':request.user,
21 'employe':employe,
22 }
23 return render_to_response('rh/perso.html', c, RequestContext(request))
24
25# employes
3411ac33 26@login_required
a9faef67 27def employes_liste(request):
28 """Liste des employés."""
29 employes = rh.Employe.objects.all()
30 c = {
31 'user':request.user,
32 'employes':employes,
33 }
34 return render_to_response('rh/employes_liste.html', c, RequestContext(request))
35
3411ac33 36@login_required
a9faef67 37def employe(request, id):
38 """Information publique sur un employé."""
39 try:
40 employe = rh.Employe.objects.get(pk=id)
41 except:
42 employe = rh.Employe.objects.none()
43 c = {
44 'user':request.user,
45 'employe':employe,
46 }
47 return render_to_response('rh/employe.html', c, RequestContext(request))