Commit | Line | Data |
---|---|---|
932eef9a AJ |
1 | # -*- encoding: utf-8 -*- |
2 | from django.db import models | |
3 | from auf_references_client.models import Discipline, Pays | |
4 | ||
5 | GENRE_CHOICES = (('H', 'Homme'), ('F', 'Femme')) | |
6 | class Personne(models.Model): | |
7 | ||
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, | |
20 | blank = True) | |
21 | actif = models.BooleanField(editable = False) | |
22 | ||
23 | def __unicode__(self): | |
24 | return u"%s %s, %s" % (self.prenom, self.nom, self.courriel) | |
25 | ||
26 | class Meta: | |
27 | ordering = ["prenom", "nom"] | |
28 | ||
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) | |
36 | ||
588d6b93 | 37 | def __unicode__(self): |
38 | return u"%s %s" % (self.personne.nom.upper(), self.personne.prenom) | |
39 | ||
932eef9a AJ |
40 | |
41 | class Groupe(models.Model): | |
42 | id = models.AutoField(primary_key=True, db_column='id') | |
43 | nom = models.CharField(max_length=255, db_column='nom') | |
44 | actif = models.BooleanField(editable = False, db_column='actif') | |
45 | ||
46 | def __unicode__(self): | |
47 | return u"%s" % (self.nom) | |
48 | ||
49 | class ChercheurGroupe(models.Model): | |
50 | chercheur = models.ForeignKey('Chercheur') | |
51 | groupe = models.ForeignKey('Groupe') | |
52 | date_inscription = models.DateField(auto_now=True) |