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