Commit | Line | Data |
---|---|---|
932eef9a AJ |
1 | # -*- encoding: utf-8 -*- |
2 | from django.db import models | |
4248e029 | 3 | from datamaster_modeles.models import * |
73cabd75 | 4 | from savoirs.models import Discipline |
932eef9a AJ |
5 | |
6 | GENRE_CHOICES = (('H', 'Homme'), ('F', 'Femme')) | |
7 | class Personne(models.Model): | |
8 | ||
9 | id = models.AutoField(primary_key=True) | |
10 | salutation = models.CharField(max_length=128, null = True, blank = True) | |
11 | nom = models.CharField(max_length=255) | |
12 | prenom = models.CharField(max_length=128, verbose_name = 'Prénom') | |
13 | courriel = models.CharField(max_length=128, blank = True) | |
14 | fonction = models.CharField(max_length=128, null = True, blank = True) | |
15 | sousfonction = models.CharField(max_length=128, null = True, blank = True, | |
16 | verbose_name = 'Sous-fonction') | |
17 | mobile = models.CharField(max_length=32, null = True, blank = True, | |
18 | verbose_name = 'Numéro de téléphone portable ') | |
19 | genre = models.CharField(max_length=1, choices=GENRE_CHOICES) | |
20 | commentaire = models.TextField(verbose_name = 'Commentaires', null = True, | |
21 | blank = True) | |
22 | actif = models.BooleanField(editable = False) | |
23 | ||
24 | def __unicode__(self): | |
25 | return u"%s %s, %s" % (self.prenom, self.nom, self.courriel) | |
26 | ||
27 | class Meta: | |
28 | ordering = ["prenom", "nom"] | |
29 | ||
7c596de2 | 30 | FONCTION_CHOICES = (('Professeur', 'Professeur'), ('Chercheur', 'Chercheur'), ('Doctorant', 'Doctorant'), ('Autre', 'Autre')) |
932eef9a AJ |
31 | class Chercheur(models.Model): |
32 | id = models.AutoField(primary_key=True, db_column='id') | |
73cabd75 AJ |
33 | personne = models.ForeignKey('Personne', db_column='personne') |
34 | pays = models.ForeignKey(Pays, null = True, db_column='pays', to_field='code', verbose_name = 'Nationalité') | |
7c596de2 AJ |
35 | fonction = models.CharField(max_length=36, choices=FONCTION_CHOICES) |
36 | scolarite = models.CharField(max_length=255, null=True, | |
37 | verbose_name = 'Diplôme le plus élevé') | |
73cabd75 | 38 | etablissement = models.ForeignKey(Etablissement, db_column='etablissement', null=True, blank=True) |
7c596de2 | 39 | #Domaine |
73cabd75 AJ |
40 | thematique = models.ForeignKey(Thematique, db_column='thematique', null=True) |
41 | ||
7c596de2 AJ |
42 | mots_cles = models.CharField(max_length=255, null=True, blank=True, |
43 | verbose_name='Mots-clés') | |
44 | these = models.CharField(max_length=255, null=True, blank=True, | |
73cabd75 AJ |
45 | verbose_name='Thèse') |
46 | discipline = models.ForeignKey(Discipline, db_column='discipline', null=True, blank=True, | |
47 | verbose_name='Champ disciplinaire') | |
7c596de2 AJ |
48 | expertise = models.TextField(null=True, blank=True, verbose_name='Domaine d\'expertise et thèmes de recherche') |
49 | url = models.URLField(max_length=255, null=True, blank=True, | |
50 | verbose_name='Adresse site Internet personnel') | |
73cabd75 | 51 | publication1 = models.CharField(max_length=255, null=True, blank=True, |
7c596de2 AJ |
52 | verbose_name = 'Publication 1') |
53 | publication2 = models.CharField(max_length=255, null=True, blank=True, | |
54 | verbose_name = 'Publication 2') | |
55 | publication3 = models.CharField(max_length=255, null=True, blank=True, | |
56 | verbose_name = 'Publication 3') | |
57 | publication4 = models.CharField(max_length=255, null=True, blank=True, | |
58 | verbose_name = 'Publication 4') | |
73cabd75 | 59 | groupes = models.ManyToManyField('Groupe', through='ChercheurGroupe', blank=True, verbose_name = 'Domaines de recherche') |
932eef9a AJ |
60 | actif = models.BooleanField(editable = False) |
61 | ||
588d6b93 | 62 | def __unicode__(self): |
63 | return u"%s %s" % (self.personne.nom.upper(), self.personne.prenom) | |
64 | ||
932eef9a AJ |
65 | |
66 | class Groupe(models.Model): | |
67 | id = models.AutoField(primary_key=True, db_column='id') | |
68 | nom = models.CharField(max_length=255, db_column='nom') | |
69 | actif = models.BooleanField(editable = False, db_column='actif') | |
70 | ||
71 | def __unicode__(self): | |
72 | return u"%s" % (self.nom) | |
73 | ||
74 | class ChercheurGroupe(models.Model): | |
73cabd75 AJ |
75 | id = models.AutoField(primary_key=True, db_column='id') |
76 | chercheur = models.ForeignKey('Chercheur', db_column='chercheur') | |
77 | groupe = models.ForeignKey('Groupe', db_column='groupe') | |
932eef9a | 78 | date_inscription = models.DateField(auto_now=True) |