Création des fichiers, début des modèles
This commit is contained in:
parent
3035a83aaf
commit
5711680e77
7 changed files with 49 additions and 0 deletions
|
@ -36,6 +36,7 @@ INSTALLED_APPS = (
|
||||||
'django.contrib.sessions',
|
'django.contrib.sessions',
|
||||||
'django.contrib.messages',
|
'django.contrib.messages',
|
||||||
'django.contrib.staticfiles',
|
'django.contrib.staticfiles',
|
||||||
|
'monstage',
|
||||||
)
|
)
|
||||||
|
|
||||||
MIDDLEWARE_CLASSES = (
|
MIDDLEWARE_CLASSES = (
|
||||||
|
|
0
monstage/__init__.py
Normal file
0
monstage/__init__.py
Normal file
3
monstage/admin.py
Normal file
3
monstage/admin.py
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
from django.contrib import admin
|
||||||
|
|
||||||
|
# Register your models here.
|
0
monstage/migrations/__init__.py
Normal file
0
monstage/migrations/__init__.py
Normal file
39
monstage/models.py
Normal file
39
monstage/models.py
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
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
|
3
monstage/tests.py
Normal file
3
monstage/tests.py
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
from django.test import TestCase
|
||||||
|
|
||||||
|
# Create your tests here.
|
3
monstage/views.py
Normal file
3
monstage/views.py
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
from django.shortcuts import render
|
||||||
|
|
||||||
|
# Create your views here.
|
Loading…
Reference in a new issue