1546: Associer des évaluateurs à des candidatures.
[auf_rh_dae.git] / project / recrutement / views.py
CommitLineData
6f2d5d58 1# -*- encoding: utf-8 -*-
2from django.shortcuts import redirect, render_to_response, get_object_or_404
362a3534 3from django.http import HttpResponse
4from django.contrib import messages
5from django.template import Context, RequestContext
6from django.shortcuts import render_to_response, redirect
6f2d5d58 7from django.template import RequestContext
8
362a3534 9from forms import *
10from models import *
6f2d5d58 11from project.recrutement import models as recr
12
13def index(request):
362a3534 14 return render_to_response('recrutement/index.html', {},
15 RequestContext(request))
16
17def 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))