Userprofil retrait du get_form
authorAli Jetha <ali.jetha@auf.org>
Thu, 30 Jun 2011 19:07:54 +0000 (15:07 -0400)
committerAli Jetha <ali.jetha@auf.org>
Thu, 30 Jun 2011 19:07:54 +0000 (15:07 -0400)
project/recrutement/admin.py

index bcbd6da..e5c4340 100644 (file)
@@ -223,36 +223,6 @@ class EvaluateurAdmin(VersionAdmin):
         (None, {'fields': ('candidats',)}),
     )
 
-    def get_form(self, request, obj=None, **kwargs):
-        """
-        Affiche la liste des users, regions et candidats, seulement si le user
-        connecté possède un UserProfile
-        """
-        form = super(EvaluateurAdmin, self).get_form(request, obj, **kwargs)
-        if form.declared_fields.has_key('user'):
-            permission_field = form.declared_fields['user']
-        else:
-            permission_field = form.base_fields['user']
-
-        if form.declared_fields.has_key('regions'):
-            region_field = form.declared_fields['regions']
-        else:
-            region_field = form.base_fields['regions']
-
-        if form.declared_fields.has_key('candidats'):
-            candidats_field = form.declared_fields['candidats']
-        else:
-            candidats_field = form.base_fields['candidats']
-
-        try:
-            user = UserProfile.objects.get(user=request.user)
-        except UserProfile.DoesNotExist:
-            region_field.queryset = Region.objects.none()
-            permission_field.queryset = UserProfile.objects.none()
-            candidats_field.queryset = Candidat.objects.none()
-            return form
-
-        return form
 
     def queryset(self, request):
         """