Filtres sur rapport poste
[auf_rh_dae.git] / project / views.py
1 # -*- encoding: utf-8 -*-
2 from datetime import date
3
4 from django.contrib.auth.decorators import login_required
5 from django.shortcuts import render_to_response
6 from django.template import RequestContext
7
8 import rh.models as rh
9
10 @login_required
11 def accueil(request):
12 """Accueil = Tableau de bord de l'utilisateur"""
13 rc = RequestContext(request)
14 c = {}
15 today = date.today()
16
17 # employés présents = metadata ok et dossiers présents
18 employes = rh.Employe.objects \
19 .filter(actif=True, supprime=False) \
20 .filter(dossiers__actif=True, dossiers__supprime=False) \
21 .exclude(dossiers__date_debut__gt=today) \
22 .exclude(dossiers__date_fin__lt=today) \
23 .order_by('?')
24
25 c['employes'] = employes[0:10]
26 return render_to_response('accueil.html', c, rc)
27
28 def erreur404(request) :
29 c = {
30 'user':request.user,
31 }
32 return render_to_response('404.html', c,
33 context_instance = RequestContext(request))
34
35 def erreur500(request) :
36 c = {
37 'user':request.user,
38 }
39 return render_to_response('500.html', c,
40 context_instance = RequestContext(request))
41
42 def erreur550(request) :
43 c = {
44 'user':request.user,
45 }
46 return render_to_response('550.html', c,
47 context_instance = RequestContext(request))