From 7d82fd339bc7f7420189d3d31b87a3f761d47a0f Mon Sep 17 00:00:00 2001 From: "nilovna.bascunan-vasquez" Date: Tue, 21 Jun 2011 17:07:59 -0400 Subject: [PATCH] 1642: Lien pour voir la fiche du candidat en lecture seule --- project/recrutement/admin.py | 14 ++- .../templates/recrutement/afficher_candidat.html | 125 ++++++++++++++++++++ project/recrutement/views.py | 8 +- project/urls.py | 3 + 4 files changed, 147 insertions(+), 3 deletions(-) create mode 100644 project/recrutement/templates/recrutement/afficher_candidat.html diff --git a/project/recrutement/admin.py b/project/recrutement/admin.py index 976997a..ab6d552 100644 --- a/project/recrutement/admin.py +++ b/project/recrutement/admin.py @@ -20,6 +20,7 @@ class OffreEmploiAdmin(VersionAdmin): _candidatsList.allow_tags = True _candidatsList.short_description = "Liste des candidats" + def get_form(self, request, obj=None, **kwargs): """ Affiche la liste des régions, seulement si le user @@ -52,6 +53,7 @@ class OffreEmploiAdmin(VersionAdmin): except UserProfile.DoesNotExist: return qs.none() + import pdb;pdb.set_trace() region_ids = [g.id for g in user.regions.all()] return qs.select_related('offre_emploi').filter(region__in=region_ids) @@ -86,7 +88,8 @@ class EvaluateurInline(admin.TabularInline): class CandidatAdmin(VersionAdmin): date_hierarchy = 'date_creation' list_display = ('nom', 'prenom', 'offre_emploi','statut', - 'voir_offre_emploi', 'evaluer_candidat', 'calculer_moyenne') + 'voir_offre_emploi', 'evaluer_candidat', 'calculer_moyenne', + 'afficher_candidat',) list_filter = ('offre_emploi', ) fieldsets = ( ("Offre d'emploi", { @@ -130,6 +133,13 @@ class CandidatAdmin(VersionAdmin): evaluer_candidat.allow_tags = True evaluer_candidat.short_description = 'Évaluer' + # Afficher un candidat + def afficher_candidat(self, obj): + return "Voir le candidat \ + " % (reverse('afficher_candidat'), obj.id) + afficher_candidat.allow_tags = True + afficher_candidat.short_description = u'Afficher les détails' + def get_form(self, request, obj=None, **kwargs): """ Affiche la liste des offres d'emploi, seulement si le user @@ -183,7 +193,7 @@ class CandidatAdmin(VersionAdmin): evaluations = CandidatEvaluation.objects.filter(candidat=obj) notes = [evaluation.note for evaluation in evaluations.all() if evaluation.note is not None] - #import pdb;pdb.set_trace() + if len(notes) > 0: moyenne_votes = float(sum(notes)) / len(notes) else: diff --git a/project/recrutement/templates/recrutement/afficher_candidat.html b/project/recrutement/templates/recrutement/afficher_candidat.html new file mode 100644 index 0000000..becbab8 --- /dev/null +++ b/project/recrutement/templates/recrutement/afficher_candidat.html @@ -0,0 +1,125 @@ +{% extends 'base.html' %} + +{% block title %}RH - Recrutement{% endblock %} +{% block titre %}Ressources humaines{% endblock %} +{% block sous_titre %}Afficher un candidat{% endblock %} + +{% block main %} +
+ {% block object-tools %}{% endblock %} + + + +
+

{{ candidat }}

+
+

Informations personnelles

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Prénom: {{ candidat.prenom }}
Nom: {{ candidat.nom }}
Genre: {{ candidat.get_genre_display }}
Nationalité: {{ candidat.nationalite }}
Date de naissance: {{ candidat.date_naissance }}
Situation familiale: {{ candidat.get_situation_famille_display }}
Nombre de dépendant: {{ candidat.nombre_dependant }}
+
+
+

Coordonnées

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Téléphone: {{ candidat.telephone }}
Courriel: {{ candidat.courriel }}
Adresse: {{ candidat.adresse }}
Ville: {{ candidat.ville }}
État/Province: {{ candidat.etat_province }}
Code postal: {{ candidat.code_postal }}
Pays: {{ candidat.pays }}
+
+
+

Informations professionnelles

+ + + + + + + + + + + + + + + + + + + +
Niveau du diplôme: {{ candidat.niveau_diplome }}
Employeur actuel: {{ candidat.employeur_actuel }}
Poste actuel: {{ candidat.poste_actuel }}
Domaine professionnel: {{ candidat.domaine_professionnel }}
+
+
+

Pièces jointes

+ + + + + + + +
+
+
+ + +
+ +{% endblock %} + diff --git a/project/recrutement/views.py b/project/recrutement/views.py index 1a56437..70b8dae 100755 --- a/project/recrutement/views.py +++ b/project/recrutement/views.py @@ -15,6 +15,12 @@ def index(request): return render_to_response('recrutement/index.html', {}, RequestContext(request)) +def afficher_candidat(request): + candidat = get_object_or_404(Candidat, id=request.GET.get('id')) + var = {'candidat': candidat} + return render_to_response("recrutement/afficher_candidat.html", var, + RequestContext(request)) + def evaluer_candidat(request): candidat = get_object_or_404(Candidat, id=request.GET.get('id')) @@ -22,7 +28,7 @@ def evaluer_candidat(request): evaluateur = UserProfile.objects.get(user=request.user) except UserProfile.DoesNotExist: messages.add_message(request, messages.ERROR, - "Vous ne pouvez pas évaluer un candidat.") + "Vous ne pouvez pas évaluer ce candidat.") return redirect("admin:recrutement_candidat_changelist") if request.method == "POST": diff --git a/project/urls.py b/project/urls.py index b37464a..674c3c8 100644 --- a/project/urls.py +++ b/project/urls.py @@ -22,6 +22,9 @@ urlpatterns = patterns( url(r'^recrutement/affecter_evaluateurs_candidats/$', 'recrutement.views.affecter_evaluateurs_candidats', name='affecter_evaluateurs_candidats'), + url(r'^recrutement/afficher_candidat/$', + 'recrutement.views.afficher_candidat', + name='afficher_candidat'), url(r'^recrutement/pieces/$', 'recrutement.views.postuler_appel_offre', name='pieces'), url(r'^recrutement/evaluer_candidat/$', 'recrutement.views.evaluer_candidat', name='evaluer_candidat'), -- 1.7.10.4