79338eb2142a2f25aa1d59b4f6d944b04ac79404
1 # -*- encoding: utf-8 -*-
3 from django
import forms
4 from django
.forms
.models
import inlineformset_factory
5 from django
.forms
.widgets
import CheckboxSelectMultiple
6 from django
.forms
import ModelForm
8 from captcha
.fields
import CaptchaField
12 ################################################################################
14 ################################################################################
15 class CandidatPieceForm(inlineformset_factory(Candidat
,
17 nom
= forms
.MultipleChoiceField(choices
=TYPE_PIECE_CHOICES
,
18 widget
=CheckboxSelectMultiple
)
20 class PostulerOffreEmploiForm(ModelForm
):
21 captcha
= CaptchaField()
22 action
= "http://127.0.0.1:8000/api/candidat_add/"
24 def __init__(self
, *args
, **kwargs
):
25 self
.offre_emploi
= kwargs
.pop('offre_id')
26 super(PostulerOffreEmploiForm
, self
).__init__(*args
, **kwargs
)
28 def save(self
, *args
, **kwargs
):
29 kwargs2
= kwargs
.copy()
30 kwargs2
['commit'] = False
31 postulation
= super(PostulerOffreEmploiForm
, self
).save(*args
, **kwargs2
)
32 if 'commit' not in kwargs
or kwargs
['commit']:
38 exclude
= ('actif', 'offre_emploi',)
39 fields
= ('nom', 'prenom', 'genre', 'nationalite', 'situation_famille',
40 'nombre_dependant', 'niveau_diplome', 'employeur_actuel',
41 'poste_actuel', 'domaine_professionnel', 'telephone',
42 'email', 'adresse', 'ville', 'code_postal', 'etat_province',