From 36b8eabbdf161a658084dd56963f23e001691477 Mon Sep 17 00:00:00 2001 From: Nilovna Bascunan-Vasquez Date: Fri, 5 Aug 2011 17:19:43 -0400 Subject: [PATCH] API: Permettre la postulation a partir du site institutionnel --- auf/django/emploi/api.py | 11 +- auf/django/emploi/forms.py | 13 +- auf/django/emploi/templates/emploi/pieces.html | 30 +++++ .../templates/emploi/postuler_appel_offre.html | 123 ++++++++++++++++++ .../emploi/templates/recrutement/pieces.html | 30 ----- .../recrutement/postuler_appel_offre.html | 135 -------------------- 6 files changed, 169 insertions(+), 173 deletions(-) create mode 100644 auf/django/emploi/templates/emploi/pieces.html create mode 100644 auf/django/emploi/templates/emploi/postuler_appel_offre.html delete mode 100644 auf/django/emploi/templates/recrutement/pieces.html delete mode 100644 auf/django/emploi/templates/recrutement/postuler_appel_offre.html diff --git a/auf/django/emploi/api.py b/auf/django/emploi/api.py index 5a7e778..4304f5b 100644 --- a/auf/django/emploi/api.py +++ b/auf/django/emploi/api.py @@ -6,6 +6,9 @@ from django.utils import simplejson from auf.django.emploi import models as emploi from auf.django.emploi import forms as emploiForms from restkit import request as req +from restkit import Resource +from httplib2 import Http +from urllib import urlencode import datamaster_modeles.models as ref class API: @@ -62,7 +65,11 @@ class API: return obj_offres_emploi def candidat_add(self, offre_id): - url = "http://127.0.0.1:8000/api/candidat_add/?id=%s" % (offre_id) - return redirect(url) + url = "http://127.0.0.1:8000/api/candidat_add/%s" % offre_id + r = Resource(url) + import pdb;pdb.set_trace() + resp = r.post(payload=self.request.POST) + + return resp.status diff --git a/auf/django/emploi/forms.py b/auf/django/emploi/forms.py index 7f963cc..79338eb 100644 --- a/auf/django/emploi/forms.py +++ b/auf/django/emploi/forms.py @@ -7,21 +7,22 @@ from django.forms import ModelForm from captcha.fields import CaptchaField -from auf.django.emploi import models as emploi +from models import * ################################################################################ # OFFRE EMPLOI ################################################################################ -class CandidatPieceForm(inlineformset_factory(emploi.Candidat, - emploi.CandidatPiece)): - nom = forms.MultipleChoiceField(choices=emploi.TYPE_PIECE_CHOICES, +class CandidatPieceForm(inlineformset_factory(Candidat, + CandidatPiece)): + nom = forms.MultipleChoiceField(choices=TYPE_PIECE_CHOICES, widget=CheckboxSelectMultiple) class PostulerOffreEmploiForm(ModelForm): captcha = CaptchaField() + action = "http://127.0.0.1:8000/api/candidat_add/" def __init__(self, *args, **kwargs): - self.offre_emploi = kwargs.pop('offre_emploi') + self.offre_emploi = kwargs.pop('offre_id') super(PostulerOffreEmploiForm, self).__init__(*args, **kwargs) def save(self, *args, **kwargs): @@ -33,7 +34,7 @@ class PostulerOffreEmploiForm(ModelForm): return postulation class Meta: - model = emploi.Candidat + model = Candidat exclude = ('actif', 'offre_emploi',) fields = ('nom', 'prenom', 'genre', 'nationalite', 'situation_famille', 'nombre_dependant', 'niveau_diplome', 'employeur_actuel', diff --git a/auf/django/emploi/templates/emploi/pieces.html b/auf/django/emploi/templates/emploi/pieces.html new file mode 100644 index 0000000..d8587d7 --- /dev/null +++ b/auf/django/emploi/templates/emploi/pieces.html @@ -0,0 +1,30 @@ + + {% for f in piecesForm.management_form %} + {{ f }} + {% endfor %} + + + {% for field in piecesForm.forms.0 %} + {% if not field.is_hidden %} + + {% endif %} + {% endfor %} + + {% for f in piecesForm.forms %} + + + {% for field in f %} + {% if not field.is_hidden %} + + {% else %} + {{ field }} + {% endif %} + {% endfor %} + + {% endfor %} +
{{ field.label }}
+ {{ f.errors }} + {% if f.initial.fichier %} + Télécharger + {% endif %} + {{ field }}
diff --git a/auf/django/emploi/templates/emploi/postuler_appel_offre.html b/auf/django/emploi/templates/emploi/postuler_appel_offre.html new file mode 100644 index 0000000..f6931be --- /dev/null +++ b/auf/django/emploi/templates/emploi/postuler_appel_offre.html @@ -0,0 +1,123 @@ +{% extends "base.html" %} +{% block Contenu%} + +
+ {% block object-tools %}{% endblock %} + +

Poster pour un appel d'offre d'emploi

+ +
+
+

Informations personnelles

+ + + + + + + + + + + + + + + + + + + + + + + + + + +
{{ form.prenom.label }}{{ form.prenom }}
{{ form.nom.label }}{{ form.nom }}
{{ form.genre.label }}{{ form.genre }}
{{ form.nationalite.label }}{{ form.nationalite }}
{{ form.situation_famille.label }}{{ form.situation_famille }}
{{ form.nombre_dependant.label }}{{ form.nombre_dependant }}
+ {{ form.nombre_dependant.help_text }} +
+
+
+

Coordonnées

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
{{ form.telephone.label }}{{ form.telephone }}
{{ form.email.label }}{{ form.email }}
{{ form.adresse.label }}{{ form.adresse }}
{{ form.ville.label }}{{ form.ville }}
{{ form.etat_province.label }}{{ form.etat_province }}
{{ form.code_postal.label }}{{ form.code_postal }}
{{ form.pays.label }}{{ form.pays }}
+
+
+

Informations professionnelles

+ + + + + + + + + + + + + + + + + + + +
{{ form.niveau_diplome.label }}{{ form.niveau_diplome }}
{{ form.employeur_actuel.label }}{{ form.employeur_actuel }}
{{ form.poste_actuel.label }}{{ form.poste_actuel }}
{{ form.domaine_professionnel.label }}{{ form.domaine_professionnel }}
+
+
+

Pièces jointes

+

CV, lettre de motivation...

+ {% include "recrutement/pieces.html" %} +
+
+

Vérification CAPTCHA

+

Entrez les caractères figurant dans l'image ci-dessous.

+ + + {{ form.captcha }} + {{ form.captcha.errors }} + + +
+
+ +
+
+ + +
+ +{% endblock %} diff --git a/auf/django/emploi/templates/recrutement/pieces.html b/auf/django/emploi/templates/recrutement/pieces.html deleted file mode 100644 index d8587d7..0000000 --- a/auf/django/emploi/templates/recrutement/pieces.html +++ /dev/null @@ -1,30 +0,0 @@ - - {% for f in piecesForm.management_form %} - {{ f }} - {% endfor %} - - - {% for field in piecesForm.forms.0 %} - {% if not field.is_hidden %} - - {% endif %} - {% endfor %} - - {% for f in piecesForm.forms %} - - - {% for field in f %} - {% if not field.is_hidden %} - - {% else %} - {{ field }} - {% endif %} - {% endfor %} - - {% endfor %} -
{{ field.label }}
- {{ f.errors }} - {% if f.initial.fichier %} - Télécharger - {% endif %} - {{ field }}
diff --git a/auf/django/emploi/templates/recrutement/postuler_appel_offre.html b/auf/django/emploi/templates/recrutement/postuler_appel_offre.html deleted file mode 100644 index 53569f0..0000000 --- a/auf/django/emploi/templates/recrutement/postuler_appel_offre.html +++ /dev/null @@ -1,135 +0,0 @@ -{% extends 'base.html' %} -{% load adminmedia %} - -{% block title %}RH{% endblock %} -{% block titre %}Ressources humaines{% endblock %} -{% block sous_titre %}Accueil{% endblock %} - -{% block main %} -
- {% block object-tools %}{% endblock %} - - - - -
-

Poster pour un appel d'offre d'emploi

-
- -
-
-

Informations personnelles

- - - - - - - - - - - - - - - - - - - - - - - - - - -
{{ form.prenom.label }}{{ form.prenom }}
{{ form.nom.label }}{{ form.nom }}
{{ form.genre.label }}{{ form.genre }}
{{ form.nationalite.label }}{{ form.nationalite }}
{{ form.situation_famille.label }}{{ form.situation_famille }}
{{ form.nombre_dependant.label }}{{ form.nombre_dependant }}
- {{ form.nombre_dependant.help_text }} - -
-
-
-

Coordonnées

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
{{ form.telephone.label }}{{ form.telephone }}
{{ form.email.label }}{{ form.email }}
{{ form.adresse.label }}{{ form.adresse }}
{{ form.ville.label }}{{ form.ville }}
{{ form.etat_province.label }}{{ form.etat_province }}
{{ form.code_postal.label }}{{ form.code_postal }}
{{ form.pays.label }}{{ form.pays }}
-
-
-

Informations professionnelles

- - - - - - - - - - - - - - - - - - - -
{{ form.niveau_diplome.label }}{{ form.niveau_diplome }}
{{ form.employeur_actuel.label }}{{ form.employeur_actuel }}
{{ form.poste_actuel.label }}{{ form.poste_actuel }}
{{ form.domaine_professionnel.label }}{{ form.domaine_professionnel }}
-
-
-

Pièces jointes

-

CV, lettre de motivation...

- {% include "recrutement/pieces.html" %} -
-
-

Vérification CAPTCHA

-

Entrez les caractères figurant dans l'image ci-dessous.

- - - {{ form.captcha }} - {{ form.captcha.errors }} - - -
-
- -
-
- - - -
- -{% endblock %} -- 1.7.10.4