39 lines
No EOL
1.4 KiB
Python
39 lines
No EOL
1.4 KiB
Python
from django.db import models
|
|
from django.contrib.auth.models import User
|
|
|
|
TYPE_STAGE_CHOICES = (
|
|
('recherche', _(u"Stage de recherche")),
|
|
)
|
|
|
|
class Normalien(models.Model):
|
|
user = models.OneToOneField(User, related_name = "profile")
|
|
permanent_mail = models.CharField("Adresse e-mail permanente", max_length = 200, blank = True)
|
|
|
|
class Meta:
|
|
verbose_name = "Profil élève"
|
|
verbose_name_plural = "Profils élèves"
|
|
|
|
def __unicode__(self):
|
|
return unicode(self.user.username)
|
|
|
|
|
|
class Stage(models.Model):
|
|
user = models.ForeignKey(Normalien, related_name = "user")
|
|
published = models.BooleanField("Visible publiquement", default = False)
|
|
type_stage = models.CharField (_(u"Type de stage"),
|
|
default = "recherche",
|
|
choices = TYPE_STAGE_CHOICES,
|
|
max_length = choices_length (TYPE_STAGE_CHOICES))
|
|
start_date = models.DateField("Date de début", blank = True, null = True)
|
|
end_date = models.DateField("Date de fin", blank = True, null = True)
|
|
|
|
class PetitCoursSubject(models.Model):
|
|
name = models.CharField(_("Matière"), max_length = 30)
|
|
users = models.ManyToManyField(stages, related_name = "matieres")
|
|
|
|
class Meta:
|
|
verbose_name = "Matière des stages"
|
|
verbose_name_plural = "Matières des stages"
|
|
|
|
def __unicode__(self):
|
|
return self.name |