Merge branch 'master' into dev
[auf_rh_dae.git] / project / views.py
CommitLineData
fd5f1d55 1# -*- encoding: utf-8 -*-
9b0a8554 2from datetime import date
3
a16928b9 4from django.contrib.auth.decorators import login_required
fd5f1d55 5from django.shortcuts import render_to_response
6from django.template import RequestContext
7
c9122f1d 8import rh.models as rh
9
a16928b9 10@login_required
c9122f1d 11def accueil(request):
12 """Accueil = Tableau de bord de l'utilisateur"""
13 rc = RequestContext(request)
14 c = {}
9b0a8554 15 today = date.today()
c9122f1d 16
9b0a8554 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('?')
c9122f1d 24
25 c['employes'] = employes[0:10]
5b42c1c1 26 return render_to_response('accueil.html', c, rc)
3411ac33 27
28def erreur404(request) :
29 c = {
30 'user':request.user,
31 }
32 return render_to_response('404.html', c,
33 context_instance = RequestContext(request))
34
35def erreur500(request) :
36 c = {
37 'user':request.user,
38 }
39 return render_to_response('500.html', c,
40 context_instance = RequestContext(request))
41
42def erreur550(request) :
43 c = {
44 'user':request.user,
45 }
46 return render_to_response('550.html', c,
47 context_instance = RequestContext(request))