page perso rh.Employe couvert
[auf_rh_dae.git] / project / rh / views.py
1 # -*- encoding: utf-8 -*-
2 from django.contrib.auth.decorators import login_required
3 from django.shortcuts import redirect, render_to_response, get_object_or_404
4 from django.template import RequestContext
5
6 from datamaster_modeles import models as ref
7 from project.decorators import user_is_this_employe
8 from project.lib import get_employe_from_id
9
10 from rh import models as rh
11
12 # homes
13 @user_is_this_employe
14 def perso(request, id):
15 """Espace personnel de l'employé."""
16 employe = get_employe_from_id(id)
17
18 c = {
19 'user':request.user,
20 'employe':employe,
21 }
22 return render_to_response('rh/perso.html', c, RequestContext(request))
23
24 # employes
25 @login_required
26 def 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
35 @login_required
36 def 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))