fixes
[auf_rh_dae.git] / project / rh / catalogues.py
CommitLineData
105dd778
OL
1# -*- encoding: utf-8 -*-
2
3from django.db.models import Q
4from auf.django.references import models as ref
5import models as rh
6
7class Pays(object):
ad1eb1db 8 fk_key = "code"
105dd778
OL
9
10 def get_query(self,q,request):
11 pays = ref.Pays.objects.filter(Q(nom__icontains=q) | Q(code__icontains=q))
12 return pays
13
14 def format_result(self, pays):
15 return unicode(pays)
16
17 def format_item(self, pays):
18 return self.format_result(pays)
19
20 def get_objects(self, ids):
21 return ref.Pays.objects.filter(code__in=ids)
22
23
24class Implantation(object):
25
26 def get_query(self,q,request):
27 f = Q(nom__icontains=q) | Q(nom_court__icontains=q) | Q(nom_long__icontains=q) | Q(region__nom__icontains=q)
28 implantations = ref.Implantation.objects.filter(f)
29 return implantations
30
31 def format_result(self, implantation):
32 return unicode(implantation)
33
34 def format_item(self, implantation):
35 return self.format_result(implantation)
36
37 def get_objects(self, ids):
38 return ref.Implantation.objects.filter(id__in=ids)
39
40class TypePoste(object):
41
42 def get_query(self,q,request):
43 f = Q(nom__icontains=q) | Q(nom_feminin__icontains=q) | Q(famille_emploi__nom__icontains=q)
44 typepostes = rh.TypePoste.objects.filter(f)
45 return typepostes
46
47 def format_result(self, typeposte):
48 return unicode(typeposte)
49
50 def format_item(self, typeposte):
51 return self.format_result(typeposte)
52
53 def get_objects(self, ids):
54 return rh.TypePoste.objects.filter(id__in=ids)
55
56class Poste(object):
57
58 def get_query(self,q,request):
59 f = Q(nom__icontains=q) | Q(type_poste__nom__icontains=q)
60 postes = rh.Poste.objects.filter(f)
61 return postes
62
63 def format_result(self, poste):
64 return unicode(poste)
65
66 def format_item(self, poste):
67 return self.format_result(poste)
68
69 def get_objects(self, ids):
70 return rh.Poste.objects.filter(id__in=ids)
71
72class ValeurPoint(object):
73
74 def get_query(self,q,request):
75 f = Q(devise__code__icontains=q) | Q(implantation__nom__icontains=q)
76 points = rh.ValeurPoint.objects.select_related('devise', 'implantation').filter(f)
77 return points
78
79 def format_result(self, point):
80 return unicode(point)
81
82 def format_item(self, point):
83 return self.format_result(point)
84
85 def get_objects(self, ids):
86 return rh.ValeurPoint.objects.filter(id__in=ids)
0b0545bd
OL
87
88class Employe(object):
89
90 def get_query(self,q,request):
91 f = Q(nom__icontains=q) | Q(prenom__icontains=q) | Q(nom_affichage__icontains=q)
92 employes = rh.Employe.objects.filter(f)
93 return employes
94
95 def format_result(self, employe):
96 return unicode(employe)
97
98 def format_item(self, employe):
99 return self.format_result(employe)
100
101 def get_objects(self, ids):
102 return rh.Employe.objects.filter(id__in=ids)
103
104class Dossier(object):
105
106 def get_query(self,q,request):
107 f = Q(poste__nom=q) | Q(poste__type_poste__nom=q) | Q(employe__nom__icontains=q) | Q(employe__prenom__icontains=q) | Q(employe__nom_affichage__icontains=q)
108 dossiers = rh.Dossier.objects.filter(f)
109 return dossiers
110
111 def format_result(self, dossier):
112 return unicode(dossier)
113
114 def format_item(self, dossier):
115 return self.format_result(dossier)
116
117 def get_objects(self, ids):
118 return rh.Dossier.objects.filter(id__in=ids)