Complétion des modèles

This commit is contained in:
champeno 2015-05-25 00:17:00 +02:00
parent 5711680e77
commit 9e07f6806c
3 changed files with 64 additions and 11 deletions

View file

@ -36,6 +36,7 @@ INSTALLED_APPS = (
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.gis',
'monstage',
)

View file

@ -1,12 +1,22 @@
from django.db import models
from django.contrib.auth.models import User
from django.utils.translation import ugettext_lazy as _
from django.contrib.gis.db import models as geomodels
TYPE_STAGE_CHOICES = (
('recherche', _(u"Stage de recherche")),
('stage', _(u"Stage")),
)
TYPE_LIEU_CHOICES = (
('universite', _(u"Université")),
('entreprise', _(u"Entreprise")),
('centrerecherche', _(u"Centre de recherche")),
('administration', _(u"Administration")),
('autre', _(u"Autre")),
)
class Normalien(models.Model):
user = models.OneToOneField(User, related_name = "profile")
user = models.OneToOneField(User, related_name = "profil")
permanent_mail = models.CharField("Adresse e-mail permanente", max_length = 200, blank = True)
class Meta:
@ -18,17 +28,30 @@ class Normalien(models.Model):
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",
user = models.ForeignKey(Normalien, related_name = "stages")
published = models.BooleanField(_("Visible publiquement"), default = False)
type_stage = models.CharField (_(u"Type"),
default = "stage",
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)
start_date = models.DateField(_(u"Date de début"), null = True)
end_date = models.DateField(_(u"Date de fin"), null = True)
sujet = models.CharField(_(u"Sujet"), max_length = 500)
encadrants = models.CharField(_(u"Encadrants"), max_length = 500, blank = True)
lieux = models.ManyToManyField(Lieu, related_name = "stages", through = "LieuStage")
class PetitCoursSubject(models.Model):
name = models.CharField(_("Matière"), max_length = 30)
# Avis
avis_encadrants = models.TextField(_(u"Avis sur les encadrants", blank = True)
avis_equipe = models.TextField(_(u"Avis sur l'équipe", blank = True)
avis_stage = models.TextField(_(u"Intérêt du stage", blank = True)
avis_admin = models.TextField(_(u"Visa et administratif"), blank = True)
def __unicode__(self):
return u"%s : %s" % (self.user.profil.username, self.sujet)
class StageMatiere(models.Model):
name = models.CharField(_(u"Matière"), max_length = 30)
users = models.ManyToManyField(stages, related_name = "matieres")
class Meta:
@ -36,4 +59,29 @@ class PetitCoursSubject(models.Model):
verbose_name_plural = "Matières des stages"
def __unicode__(self):
return self.name
return self.name
class Lieu(models.Model):
name = models.CharField(_(u"Nom de l'institution d'accueil"), max_length = 250)
ville = models.CharField(_(u"Ville, Pays"), max_length = 200)
coord = geomodels.PointField(_(u"Coordonnées"), geography = True)
objects = geomodels.GeoManager() # Requis par GeoDjango
type_lieu = models.CharField( _(u"Type de structure d'accueil"),
default = "universite",
choices = TYPE_LIEU_CHOICES,
max_length = choices_length (TYPE_LIEU_CHOICES))
def __unicode__(self):
return u"%s (%s)" % (self.name, self.ville)
class LieuStage(models.Model):
stage = models.ForeignKey(Stage)
lieu = models.ForeignKey(Lieu)
# Avis
avis_global = models.TextField(_(u"Ressenti global"), blank = True)
avis_lieudevie = models.TextField(_(u"Mon lieu de vie"), blank = True)
avis_lieustage = models.TextField(_(u"Le lieu du stage"), blank = True)
avis_pratique = models.TextField(_(u"S'installer / Conseils pratiques"), blank = True)
avis_visite = models.TextField(_(u"Que voir / que faire"), blank = True)
avis_anecdotes = models.TextField(_(u"Anecdotes"), blank = True)

4
requirements.txt Normal file
View file

@ -0,0 +1,4 @@
django>=1.7
django-cas-ng
psycopg2
postgis