1 # -*- encoding: utf-8 -*-
2 from django
.db
import models
3 from auf_references_client
.models
import Discipline
, Pays
, Etablissement
, Thematique
5 GENRE_CHOICES
= (('H', 'Homme'), ('F', 'Femme'))
6 class Personne(models
.Model
):
8 id = models
.AutoField(primary_key
=True)
9 salutation
= models
.CharField(max_length
=128, null
= True, blank
= True)
10 nom
= models
.CharField(max_length
=255)
11 prenom
= models
.CharField(max_length
=128, verbose_name
= 'Prénom')
12 courriel
= models
.CharField(max_length
=128, blank
= True)
13 fonction
= models
.CharField(max_length
=128, null
= True, blank
= True)
14 sousfonction
= models
.CharField(max_length
=128, null
= True, blank
= True,
15 verbose_name
= 'Sous-fonction')
16 mobile
= models
.CharField(max_length
=32, null
= True, blank
= True,
17 verbose_name
= 'Numéro de téléphone portable ')
18 genre
= models
.CharField(max_length
=1, choices
=GENRE_CHOICES
)
19 commentaire
= models
.TextField(verbose_name
= 'Commentaires', null
= True,
21 actif
= models
.BooleanField(editable
= False)
23 def __unicode__(self
):
24 return u
"%s %s, %s" % (self
.prenom
, self
.nom
, self
.courriel
)
27 ordering
= ["prenom", "nom"]
29 FONCTION_CHOICES
= (('Professeur', 'Professeur'), ('Chercheur', 'Chercheur'), ('Doctorant', 'Doctorant'), ('Autre', 'Autre'))
30 class Chercheur(models
.Model
):
31 id = models
.AutoField(primary_key
=True, db_column
='id')
32 personne
= models
.ForeignKey('Personne')
33 pays
= models
.ForeignKey(Pays
, null
= True, verbose_name
= 'Nationalité')
34 fonction
= models
.CharField(max_length
=36, choices
=FONCTION_CHOICES
)
35 scolarite
= models
.CharField(max_length
=255, null
=True,
36 verbose_name
= 'Diplôme le plus élevé')
39 etablissement
= models
.ForeignKey(Etablissement
, null
=True, blank
=True)
42 thematique
= models
.ForeignKey(Thematique
, null
=True)
46 mots_cles
= models
.CharField(max_length
=255, null
=True, blank
=True,
47 verbose_name
='Mots-clés')
48 these
= models
.CharField(max_length
=255, null
=True, blank
=True,
52 discipline
= models
.ForeignKey(Discipline
, null
=True,
53 verbose_name
='Champ disciplinaire')
54 expertise
= models
.TextField(null
=True, blank
=True, verbose_name
='Domaine d\'expertise et thèmes de recherche')
55 url
= models
.URLField(max_length
=255, null
=True, blank
=True,
56 verbose_name
='Adresse site Internet personnel')
58 publication1
= models
.CharField(max_length
=255, null
=True,
59 verbose_name
= 'Publication 1')
60 publication2
= models
.CharField(max_length
=255, null
=True, blank
=True,
61 verbose_name
= 'Publication 2')
62 publication3
= models
.CharField(max_length
=255, null
=True, blank
=True,
63 verbose_name
= 'Publication 3')
64 publication4
= models
.CharField(max_length
=255, null
=True, blank
=True,
65 verbose_name
= 'Publication 4')
71 groupes
= models
.ManyToManyField('Groupe', through
='ChercheurGroupe')
72 actif
= models
.BooleanField(editable
= False)
74 def __unicode__(self
):
75 return u
"%s %s" % (self
.personne
.nom
.upper(), self
.personne
.prenom
)
78 class Groupe(models
.Model
):
79 id = models
.AutoField(primary_key
=True, db_column
='id')
80 nom
= models
.CharField(max_length
=255, db_column
='nom')
81 actif
= models
.BooleanField(editable
= False, db_column
='actif')
83 def __unicode__(self
):
84 return u
"%s" % (self
.nom
)
86 class ChercheurGroupe(models
.Model
):
87 chercheur
= models
.ForeignKey('Chercheur')
88 groupe
= models
.ForeignKey('Groupe')
89 date_inscription
= models
.DateField(auto_now
=True)