Retrait de forms non-pertinent dans le package
[auf_rh_dae.git] / project / recrutement / forms.py
CommitLineData
83252c4c 1# -*- encoding: utf-8 -*-
2
3import os
4from django import forms
5from django.contrib import admin
6from django.forms.models import inlineformset_factory
ee42ad96 7from datetime import timedelta
8from django.forms.widgets import CheckboxSelectMultiple
9from django.contrib.admin import widgets as admin_widgets
8ea41642 10from form_utils.forms import BetterModelForm
83252c4c 11from django.forms import ModelForm
2b3edf33 12from django.forms.models import BaseInlineFormSet
240940e1 13from django.core.mail import send_mail
ee42ad96 14
ec517164 15from tinymce.widgets import TinyMCE
86caaf03 16from captcha.fields import CaptchaField
ec517164 17
18from recrutement import models as recr
240940e1
NBV
19from auf.django.emploi import forms as emploi
20
21
83252c4c 22
23################################################################################
24# EVALUATION
25################################################################################
26class CandidatEvaluationForm(ModelForm):
27 def __init__(self, *args, **kwargs):
28 self.candidat = kwargs.pop('candidat')
e34a2ae0 29 self.evaluateur = kwargs.pop('evaluateur')
83252c4c 30 super(CandidatEvaluationForm, self).__init__(*args, **kwargs)
31
32 def save(self):
33 super(CandidatEvaluationForm, self).save()
34
35 class Meta:
e34a2ae0 36 fields = ('note', 'commentaire')
2b3edf33 37 model = recr.CandidatEvaluation
83252c4c 38
39class EvaluateurForm(forms.Form):
8ea41642 40 evaluateurs = forms.ModelMultipleChoiceField(queryset=
27c81d11 41 recr.Evaluateur.objects.all())
83252c4c 42
43 def __init__(self, *args, **kwargs):
44 self.candidats = kwargs.pop('candidats')
45 super(EvaluateurForm, self).__init__(*args, **kwargs)
46
47 def save(self):
21b02da5
NBV
48 for candidat in self.candidats:
49 for evaluateur in self.cleaned_data.get('evaluateurs', []):
c4874d66 50 candidat_evaluation = recr.CandidatEvaluation()
21b02da5
NBV
51 candidat_evaluation.candidat = candidat
52 candidat_evaluation.evaluateur = evaluateur
c4874d66 53 candidat_evaluation.save()
83252c4c 54
55################################################################################
56# OFFRE EMPLOI
57################################################################################
240940e1
NBV
58class CandidatPieceForm(emploi.CandidatPieceForm):
59 pass
86caaf03 60
240940e1
NBV
61class PostulerOffreEmploiForm(emploi.PostulerOffreEmploiForm):
62 pass
ec517164 63
d84c3a68 64################################################################################
65# TEMPLATE COURRIEL
66################################################################################
32834000
NBV
67class CandidatCourrielTemplateForm(ModelForm):
68 def get_template(self):
69 return self.data['template']
d84c3a68 70
32834000
NBV
71 class Meta:
72 model = recr.CandidatCourriel
73 fields = ('template', )
74
75class CandidatCourrielForm(ModelForm):
d84c3a68 76 def __init__(self, *args, **kwargs):
77 self.candidats = kwargs.pop('candidats')
32834000 78 self.template = kwargs.pop('template')
d84c3a68 79 super(CandidatCourrielForm, self).__init__(*args, **kwargs)
80
81 def save(self):
82 super(CandidatCourrielForm, self).save()
83
84 class Meta:
85 model = recr.CandidatCourriel
32834000 86 fields = ('sujet', 'plain_text', 'html')
d84c3a68 87