1 # -=- encoding: utf-8 -=-
5 from django
.core
.files
.storage
import FileSystemStorage
6 from django
.db
import models
9 import datamaster_modeles
.models
as ref
10 from project
.rh
import models
as rh
14 class Metadata(models
.Model
):
16 Metadata.actif = flag remplaçant la suppression.
17 actif == False : objet réputé supprimé.
19 actif
= models
.BooleanField(default
=True)
20 date_creation
= models
.DateField(auto_now_add
=True)
26 class OffreEmploi(Metadata
):
27 # TODO : Afficher les bureaux selon la région choisies?
28 nom
= models
.CharField(max_length
=255)
29 resume
= models
.TextField()
30 description
= models
.TextField()
31 poste
= models
.ForeignKey(rh
.Poste
, db_column
='poste')
32 date_limite
= models
.DateField(verbose_name
="Date limite")
33 region
= models
.ForeignKey(ref
.Region
, db_column
='region')
34 bureau
= models
.ForeignKey(ref
.Bureau
, db_column
='bureau')
36 def __unicode__(self
):
37 return '%s [%s]' % (self
.nom
, self
.id)
55 ('SEL', 'Sélectionné'),
57 ('REC', 'Recevable'), # Trouver une lettre plus appropriée?
60 class Candidat(Metadata
):
61 # TODO : Automatiser le statut à la création à Nouveau
62 offre_emploi
= models
.ForeignKey('OffreEmploi', db_column
='offre_emploi',
63 related_name
='candidats')
64 prenom
= models
.CharField(max_length
=255)
65 nom
= models
.CharField(max_length
=255)
66 genre
= models
.CharField(max_length
=1, choices
=GENRE_CHOICES
)
67 nationalite
= models
.ForeignKey(ref
.Pays
,
68 db_column
='nationalite',
69 related_name
='candidat_nationalite')
70 date_naissance
= models
.DateField(verbose_name
="Date de naissance")
71 situation_famille
= models
.CharField(max_length
=1,
72 choices
=SITUATION_CHOICES
)
73 nombre_dependant
= models
.IntegerField(verbose_name
="Nombre de dépendant")
74 niveau_diplome
= models
.CharField(max_length
=255,
75 verbose_name
="Niveau du diplôme")
76 employeur_actuel
= models
.CharField(max_length
=255)
77 poste_actuel
= models
.CharField(max_length
=255)
78 domaine_professionnel
= models
.CharField(max_length
=255)
81 adresse
= models
.CharField(max_length
=255)
82 ville
= models
.CharField(max_length
=255)
83 etat_province
= models
.CharField(max_length
=255,
84 verbose_name
="État/Province")
85 pays
= models
.ForeignKey(ref
.Pays
, db_column
='pays',
86 related_name
='candidats')
88 statut
= models
.CharField(max_length
=4,
89 choices
=STATUT_CHOICES
)
91 def __unicode__(self
):
92 return '%s %s [%s]' % (self
.prenom
, self
.nom
, self
.id)
96 storage_prive
= FileSystemStorage(settings
.PRIVE_MEDIA_ROOT
,
97 base_url
=settings
.PRIVE_MEDIA_URL
)
99 def candidat_piece_dispatch(instance
, filename
):
100 path
= "offre_emploi/%s_%s/%s/%s_%s" % (instance
.candidat
.nom
,
101 instance
.candidat
.prenom
, instance
.nom
, instance
.candidat
.id,
105 class CandidatPiece(models
.Model
):
106 candidat
= models
.ForeignKey(Candidat
, db_column
='candidat',
108 nom
= models
.CharField(max_length
=255)
109 path
= models
.FileField(upload_to
=candidat_piece_dispatch
,
110 storage
=storage_prive
)
112 def __unicode__(self
):
113 return '%s' % (self
.nom
)
115 class Evaluateur(models
.Model
):
116 candidats
= models
.ManyToManyField(Candidat
)
118 class CandidatEvaluation(models
.Model
):
119 candidat
= models
.ForeignKey(Candidat
, db_column
='candidat',
120 related_name
='candidats')
121 evaluateur
= models
.ForeignKey(Evaluateur
, db_column
='evaluateur',
122 related_name
='evaluateurs')
123 note
= models
.IntegerField()
124 commentaire
= models
.TextField()
125 date
= models
.DateField(auto_now_add
=True)