1546: Associer des évaluateurs à des candidatures.
[auf_rh_dae.git] / project / recrutement / views.py
1 # -*- encoding: utf-8 -*-
2 from django.shortcuts import redirect, render_to_response, get_object_or_404
3 from django.http import HttpResponse
4 from django.contrib import messages
5 from django.template import Context, RequestContext
6 from django.shortcuts import render_to_response, redirect
7 from django.template import RequestContext
8
9 from forms import *
10 from models import *
11 from project.recrutement import models as recr
12
13 def index(request):
14 return render_to_response('recrutement/index.html', {},
15 RequestContext(request))
16
17 def affecter_evaluateurs_candidats(request):
18 candidat_ids = request.GET.get('ids').split(',')
19 candidats = Candidat.objects.filter(id__in=candidat_ids)
20 if request.method == "POST":
21 form = EvaluateurForm(request.POST, candidats=candidats)
22 if form.is_valid():
23 form.save()
24 messages.add_message(request, messages.SUCCESS,
25 "Les évaluateurs ont été affectés aux candidats.")
26 return redirect("admin:recrutement_candidat_changelist")
27 else:
28 form = EvaluateurForm(candidats=candidats)
29
30 c = {'form' : form}
31 return render_to_response("recrutement/affecter_evaluateurs.html", Context(c), context_instance = RequestContext(request))