Première version en Python-Django.
[auf_paf.git] / paf / models.py
1 # -*- coding: utf8 -*-
2 from django.db import models
3 from django.contrib.auth.models import User
4 from smart_selects.db_fields import ChainedForeignKey
5
6 class Student(models.Model):
7 GENDER_CHOICES = (
8 ('M', 'Male'),
9 ('F', 'Female'),
10 )
11 NATIONALITY_CHOICES = (
12 ('KH', 'Cambodgienne'),
13 ('LA', 'Laotienne'),
14 ('VN', 'Vietnamienne'),
15 ('ZZ', 'Autre'),
16 )
17 identifier = models.CharField('identifiant',max_length=9, blank=True)
18 lastname = models.CharField('nom', max_length=50)
19 firstname = models.CharField(u"prénom", max_length=50)
20 nationality = models.CharField(u"nationalité", max_length=2, choices=NATIONALITY_CHOICES)
21 sex = models.CharField('sexe', max_length=1, choices=GENDER_CHOICES)
22 dob = models.DateField('date de naissance', help_text='Enter la date sous forme dd/mm/yyyy')
23 email = models.EmailField('e-mail', blank=True)
24 tel = models.CharField('téléphone', max_length=20)
25 parent_tel = models.CharField('téléphone de parents', max_length=20, blank=True)
26 parent_address = models.CharField('adresse de parents', max_length=120)
27
28 class Meta:
29 verbose_name = 'Etudiant'
30
31 def __unicode__(self):
32 return u'%s %s' % (self.firstname, self.lastname)
33
34 class LinguisticLevel(models.Model):
35 DELF_DALF_CHOICES = (
36 ('A1', 'A1'),
37 ('A2', 'A2'),
38 ('B1', 'B1'),
39 ('B2', 'B2'),
40 ('C1', 'C1'),
41 ('C2', 'C2'),
42 )
43 OTHER_CHOICES = (
44 ('D', 'Debutant'),
45 ('I', 'Intermediare'),
46 ('A', 'Avance'),
47 )
48 delf_dalf = models.CharField('delf/dalf', max_length=2, choices=DELF_DALF_CHOICES, blank=True)
49 year_delf_dalf = models.PositiveIntegerField(u'année obtenue', blank=True, null=True)
50 other = models.CharField('autre', max_length=1, choices=OTHER_CHOICES, blank=True)
51 year_other = models.PositiveIntegerField(u'année obtenue', blank=True, null=True)
52 student = models.OneToOneField(Student)
53
54 class Meta:
55 verbose_name = 'Niveau linguistique'
56
57
58 def __unicode__(self):
59 return u''
60
61 class Level(models.Model):
62 name = models.CharField('nom', max_length=100)
63
64 class Meta:
65 verbose_name = 'Niveau'
66 verbose_name_plural = 'Niveaux'
67
68 def __unicode__(self):
69 return self.name
70
71 class University(models.Model):
72 name = models.CharField('nom', max_length=100)
73
74 class Meta:
75 verbose_name = u"Université"
76
77 def __unicode__(self):
78 return self.name
79
80 class Country(models.Model):
81 name = models.CharField('nom', max_length=100)
82
83 class Meta:
84 verbose_name = 'Pays'
85 verbose_name_plural = 'Pays'
86
87 def __unicode__(self):
88 return self.name
89
90 class City(models.Model):
91 name = models.CharField('nom', max_length=100)
92
93 class Meta:
94 verbose_name = 'Ville'
95
96 def __unicode__(self):
97 return self.name
98
99 class Entreprise(models.Model):
100 name = models.CharField('nom', max_length=100)
101
102 def __unicode__(self):
103 return self.name
104
105
106 class Faculty(models.Model):
107 name = models.CharField('nom', max_length=100)
108 university = models.ForeignKey(University)
109
110 class Meta:
111 verbose_name = u"Faculté"
112
113 def __unicode__(self):
114 return self.name
115
116 class CurrentAcademic(models.Model):
117 university = models.ForeignKey(University, verbose_name=u"université")
118 faculty = ChainedForeignKey(
119 Faculty,
120 chained_field="university",
121 chained_model_field="university",
122 show_all=False,
123 auto_choose=True,
124 verbose_name=u"faculté"
125 )
126 city = models.ForeignKey(City, verbose_name='Ville')
127 level = models.ForeignKey(Level, verbose_name='Niveau')
128 specialty = models.CharField(max_length=200, verbose_name=u'Spécialité')
129 entry_year = models.PositiveIntegerField(verbose_name=u"Année d'entrée")
130 end_year = models.PositiveIntegerField(blank=True, null=True, verbose_name="année de sortie")
131 certified = models.NullBooleanField(verbose_name=u"Diplomé")
132 student = models.OneToOneField(Student)
133
134 class Meta:
135 verbose_name = u"Parcous académique actuel"
136
137
138 class DiplomaObtained(models.Model):
139 university = models.ForeignKey(University, verbose_name=u"Université")
140 level = models.ForeignKey(Level, verbose_name=u"Niveau")
141 entitle = models.CharField(max_length=200, verbose_name=u"Intitulé")
142 year = models.PositiveIntegerField(verbose_name=u"Année")
143 student = models.ForeignKey(Student)
144 class Meta:
145 verbose_name = u"Diplôme obtenu"
146 verbose_name_plural = u"Diplômes obtenus"
147
148 class Employment(models.Model):
149 entreprise = models.ForeignKey(Entreprise)
150 activity_sector = models.CharField(max_length=200, verbose_name=u"Secteur d'activité")
151 country = models.ForeignKey(Country, verbose_name=u"pays")
152 website = models.URLField(verbose_name=u"site web")
153 position = models.CharField(max_length=200)
154 detail_position = models.TextField(verbose_name=u"Détail de responsabilité")
155 observation = models.CharField(max_length=200, blank=True)
156 student = models.OneToOneField(Student)
157 class Meta:
158 verbose_name = u"Emploiement"