1 # -*- encoding: utf-8 -*-
2 from django
.db
import models
3 from auf_references_client
.models
import Discipline
, Pays
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 class Chercheur(models
.Model
):
30 id = models
.AutoField(primary_key
=True, db_column
='id')
31 personne
= models
.ForeignKey('Personne')
32 discipline
= models
.ForeignKey(Discipline
)
33 pays
= models
.ForeignKey(Pays
)
34 groupes
= models
.ManyToManyField('Groupe', through
='ChercheurGroupe')
35 actif
= models
.BooleanField(editable
= False)
38 class Groupe(models
.Model
):
39 id = models
.AutoField(primary_key
=True, db_column
='id')
40 nom
= models
.CharField(max_length
=255, db_column
='nom')
41 actif
= models
.BooleanField(editable
= False, db_column
='actif')
43 def __unicode__(self
):
44 return u
"%s" % (self
.nom
)
46 class ChercheurGroupe(models
.Model
):
47 chercheur
= models
.ForeignKey('Chercheur')
48 groupe
= models
.ForeignKey('Groupe')
49 date_inscription
= models
.DateField(auto_now
=True)