PJ ofrre emploi
[auf_rh_dae.git] / src / auf.django.emploi / auf / django / emploi / forms.py
CommitLineData
0d9e7dce
NBV
1# -*- encoding: utf-8 -*-
2
0d9e7dce 3from django import forms
0d9e7dce
NBV
4from django.forms.models import inlineformset_factory
5from django.forms.widgets import CheckboxSelectMultiple
6from django.forms import ModelForm
7
8from captcha.fields import CaptchaField
9
43198a9f 10from models import *
0d9e7dce
NBV
11
12################################################################################
13# OFFRE EMPLOI
14################################################################################
43198a9f
NBV
15class CandidatPieceForm(inlineformset_factory(Candidat,
16 CandidatPiece)):
17 nom = forms.MultipleChoiceField(choices=TYPE_PIECE_CHOICES,
0d9e7dce
NBV
18 widget=CheckboxSelectMultiple)
19
3a542b85
NBV
20 def __init__(self, *args, **kwargs):
21 super(CandidatPieceForm, self).__init__(*args, **kwargs)
22
23 def save(self, *args, **kwargs):
24 super(CandidatPieceForm, self).save(*args, **kwargs)
25
26
c2141437
OL
27POSTULER_FORM_EXCLUDES = ('actif', 'offre_emploi',)
28POSTULER_FORM_FIELDS = ('nom', 'prenom', 'genre', 'nationalite', 'situation_famille',
29 'nombre_dependant', 'niveau_diplome', 'employeur_actuel',
30 'poste_actuel', 'domaine_professionnel', 'telephone',
31 'email', 'adresse', 'ville', 'code_postal', 'etat_province',
32 'pays', )
0d9e7dce 33
c2141437
OL
34class NoCaptchaPostulerOffreEmploiForm(ModelForm):
35 class Meta:
36 model = Candidat
37 exclude = POSTULER_FORM_EXCLUDES
38 fields = POSTULER_FORM_FIELDS
0d9e7dce 39
c2141437
OL
40class PostulerOffreEmploiForm(ModelForm):
41 captcha = CaptchaField()
0d9e7dce
NBV
42
43 class Meta:
43198a9f 44 model = Candidat
c2141437
OL
45 exclude = POSTULER_FORM_EXCLUDES
46 fields = POSTULER_FORM_FIELDS + ('captcha', )