Fix for selection using proper SELECT 1.6.5
authorBenoit C. Sirois <benoit.clennett-sirois@auf.org>
Mon, 25 Feb 2013 15:18:55 +0000 (10:18 -0500)
committerBenoit C. Sirois <benoit.clennett-sirois@auf.org>
Mon, 25 Feb 2013 15:18:55 +0000 (10:18 -0500)
project/dae/forms.py

index c409c9b..2a931c1 100644 (file)
@@ -88,7 +88,7 @@ class BaseInlineFormSetWithInitial(BaseInlineFormSet):
 def _implantation_choices(obj, request):
     # TRAITEMENT NORMAL
     employe = groups.get_employe_from_user(request.user)
-    q = Q(**{'zone_administrative': employe.implantation.zone_administrative})
+    q = Q(**{'zone_administrative__in': groups.get_zones_from_user(request.user)})
 
     # TRAITEMENT DRH
     user_groupes = [g.name for g in request.user.groups.all()]
@@ -103,13 +103,13 @@ def _employe_choices(obj, request):
     # TRAITEMENT NORMAL
     employe = groups.get_employe_from_user(request.user)
     q_dae_region_service = Q(
-        poste__implantation__zone_administrative=(
-            employe.implantation.zone_administrative
+        poste__implantation__zone_administrative__in=(
+            groups.get_zones_from_user(request.user)
         )
     )
     q_rh_region_service = Q(
-        poste__implantation__zone_administrative=(
-            employe.implantation.zone_administrative
+        poste__implantation__zone_administrative__in=(
+            groups.get_zones_from_user(request.user)
         )
     )
     # TRAITEMENT DRH