this is for displaying the currently selected items (in the case of a ManyToMany field)
"""
return rh.Dossier.objects.filter(pk__in=ids)
+
+class Poste(object):
+
+ def get_query(self,q,request):
+
+ employe = get_employe_from_user(request.user)
+ prefixe_implantation = 'poste1__implantation'
+
+ q_recherche = Q(complement1__icontains=q) | Q(poste1__type_poste__nom__icontains=q)
+
+ if is_user_dans_services_centraux(request.user):
+ q_place = Q(**{ '%s' % prefixe_implantation : employe.implantation })
+ else:
+ q_place = Q(**{ '%s__region' % prefixe_implantation : employe.implantation.region })
+
+
+ if grp_drh in request.user.groups.all():
+ q_filtre = q_recherche
+ else:
+ q_filtre = q_place & q_recherche
+ return rh.Dossier.objects.filter(q_filtre).distinct()
+
+ def format_result(self, dossier):
+ return u"[%s] %s" % (dossier.poste1.implantation, dossier.poste1.type_poste.nom)
+
+ def format_item(self, dossier):
+ """ the display of a currently selected object in the area below the search box. html is OK """
+ return self.format_result(dossier)
+
+ def get_objects(self, ids):
+ """ given a list of ids, return the objects ordered as you would like them on the admin page.
+ this is for displaying the currently selected items (in the case of a ManyToMany field)
+ """
+ return rh.Dossier.objects.filter(pk__in=ids)