1 # -*- encoding: utf-8 -*-
2 from django
.db
import models
3 from datamaster_modeles
.models
import *
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)
43 thematique
= models
.CharField(max_length
=255, 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,
51 #discipline = models.ForeignKey(Discipline, null=True,
52 # verbose_name='Champ disciplinaire')
53 discipline
= models
.CharField(max_length
=255, null
=True)
55 expertise
= models
.TextField(null
=True, blank
=True, verbose_name
='Domaine d\'expertise et thèmes de recherche')
56 url
= models
.URLField(max_length
=255, null
=True, blank
=True,
57 verbose_name
='Adresse site Internet personnel')
59 publication1
= models
.CharField(max_length
=255, null
=True,
60 verbose_name
= 'Publication 1')
61 publication2
= models
.CharField(max_length
=255, null
=True, blank
=True,
62 verbose_name
= 'Publication 2')
63 publication3
= models
.CharField(max_length
=255, null
=True, blank
=True,
64 verbose_name
= 'Publication 3')
65 publication4
= models
.CharField(max_length
=255, null
=True, blank
=True,
66 verbose_name
= 'Publication 4')
68 groupes
= models
.ManyToManyField('Groupe', through
='ChercheurGroupe')
69 actif
= models
.BooleanField(editable
= False)
71 def __unicode__(self
):
72 return u
"%s %s" % (self
.personne
.nom
.upper(), self
.personne
.prenom
)
75 class Groupe(models
.Model
):
76 id = models
.AutoField(primary_key
=True, db_column
='id')
77 nom
= models
.CharField(max_length
=255, db_column
='nom')
78 actif
= models
.BooleanField(editable
= False, db_column
='actif')
80 def __unicode__(self
):
81 return u
"%s" % (self
.nom
)
83 class ChercheurGroupe(models
.Model
):
84 chercheur
= models
.ForeignKey('Chercheur')
85 groupe
= models
.ForeignKey('Groupe')
86 date_inscription
= models
.DateField(auto_now
=True)