From: Nilovna Bascunan-Vasquez Date: Tue, 16 Aug 2011 14:22:48 +0000 (-0400) Subject: Ajout bouton impression avec style d'impression pour les fiches des candidats X-Git-Tag: 1.0~11^2~1 X-Git-Url: http://git.auf.org/?p=auf_django_emploi.git;a=commitdiff_plain;h=efd28a79de35fa271375f775e003073fb983d71c Ajout bouton impression avec style d'impression pour les fiches des candidats --- diff --git a/auf/django/emploi/api.py b/auf/django/emploi/api.py index 9e9d815..1d54999 100644 --- a/auf/django/emploi/api.py +++ b/auf/django/emploi/api.py @@ -3,18 +3,22 @@ from django.shortcuts import render_to_response, redirect, get_object_or_404 from django.template import Context, RequestContext from django.utils import simplejson -from auf.django.emploi import models as emploi +import datamaster_modeles.models as ref + from restkit import request as req from restkit import Resource from httplib2 import Http -from urllib import urlencode -import datamaster_modeles.models as ref -from poster.encode import MultipartParam -from poster.encode import multipart_encode import urllib2 -import settings +from poster.encode import multipart_encode, MultipartParam +from poster.streaminghttp import StreamingHTTPHandler, StreamingHTTPRedirectHandler, StreamingHTTPSHandler, register_openers +from StringIO import StringIO +import urllib2, poster.streaminghttp + +import settings +from auf.django.emploi import models as emploi + STATUS_OK = '200 OK' class API: @@ -37,6 +41,7 @@ class API: for offre_dict in liste_offres: offre = emploi.OffreEmploi() + offre.id = offre_dict['id'] offre.est_affiche = offre_dict['est_affiche'] offre.statut = offre_dict['statut'] offre.nom = offre_dict['nom'] @@ -49,7 +54,8 @@ class API: offre.duree_affectation = offre_dict['duree_affectation'] offre.renumeration = offre_dict['renumeration'] offre.debut_affectation = offre_dict['debut_affectation'] - offre.lieu_affectation = ref.Implantation.objects.get(id=offre_dict['lieu_affectation']) + offre.lieu_affectation = ref.Implantation.objects.\ + get(id=offre_dict['lieu_affectation']) obj_offres_emploi.append(offre) return obj_offres_emploi @@ -68,6 +74,7 @@ class API: obj_offres_emploi = [] offre = emploi.OffreEmploi() + offre.id = offre_dict['id'] offre.est_affiche = offre_dict['est_affiche'] offre.statut = offre_dict['statut'] offre.nom = offre_dict['nom'] @@ -80,7 +87,8 @@ class API: offre.duree_affectation = offre_dict['duree_affectation'] offre.renumeration = offre_dict['renumeration'] offre.debut_affectation = offre_dict['debut_affectation'] - offre.lieu_affectation = ref.Implantation.objects.get(id=offre_dict['lieu_affectation']) + offre.lieu_affectation = ref.Implantation.objects.\ + get(id=offre_dict['lieu_affectation']) obj_offres_emploi.append(offre) return obj_offres_emploi @@ -89,12 +97,7 @@ class API: url = getattr(settings, "RECRUTEMENT_URL")[env] + "candidat_add/%s" else: raise ImportError, "Could not import settings RECRUTEMENT_PATH" - r = Resource(url % offre_id) - mp = MultipartParam.from_file('cv', self.request.POST.get('candidat_piece-0-nom')) - datagen, headers = multipart_encode([image_param]) - resp = r.post(payload=self.request.FILES, params_dict=self.request.POST) - if resp.status == STATUS_OK: - candidat_id = simplejson.loads(resp.body_string())['candidat_id'] - return candidat_id + + return None diff --git a/auf/django/emploi/forms.py b/auf/django/emploi/forms.py index 7a4a9e3..02e8b97 100644 --- a/auf/django/emploi/forms.py +++ b/auf/django/emploi/forms.py @@ -17,11 +17,6 @@ class CandidatPieceForm(inlineformset_factory(Candidat, nom = forms.MultipleChoiceField(choices=TYPE_PIECE_CHOICES, widget=CheckboxSelectMultiple) - def __init__(self, *args, **kwargs): - super(CandidatPieceForm, self).__init__(*args, **kwargs) - - def save(self, *args, **kwargs): - super(CandidatPieceForm, self).save(*args, **kwargs) class PostulerOffreEmploiForm(ModelForm):