17530fb0a5e295fc1633bc13719d039ba66a3e00
[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.rh import models as rh
8 from project.decorators import user_is_this_employe
9
10
11 # homes
12 @user_is_this_employe
13 def 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
26 @login_required
27 def 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
36 @login_required
37 def 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))