from django.contrib import admin
from django.core.urlresolvers import reverse
from django.db.models import Avg
+from django.shortcuts import render_to_response
+from django.template import RequestContext
+
+from auf.django.emploi.models import STATUT_CHOICES
from django.forms.models import BaseInlineFormSet
from django.http import HttpResponseRedirect
from django.shortcuts import redirect
CandidatPieceInline,
CandidatEvaluationInline,
]
- actions = ['envoyer_courriel_candidats']
+ actions = ['envoyer_courriel_candidats', 'changer_statut']
def _candidat(self, obj):
txt = u"%s %s (%s)" % (obj.nom.upper(), obj.prenom, obj.genre)
)
envoyer_courriel_candidats.short_description = u'Envoyer courriel'
+ ### Changer le statut à des candidats
+ def changer_statut(modeladmin, request, queryset):
+ if request.POST.get('post'):
+ queryset.update(statut=request.POST.get('statut'))
+ return None
+
+ context = {
+ 'action_checkbox_name': admin.helpers.ACTION_CHECKBOX_NAME,
+ 'queryset': queryset,
+ 'status': STATUT_CHOICES,
+ }
+
+ return render_to_response("recrutement/selectionner_statut.html",
+ context, context_instance = RequestContext(request))
+
+ changer_statut.short_description = u'Changer statut'
+
### Évaluer un candidat
def evaluer_candidat(self, obj):
return "<a href='%s?candidat__id__exact=%s'>" \