Verified Commit 31f6ee9c authored by Sli's avatar Sli
Browse files

pedagogy: create first iteration of UV model

parent b49f204e
Pipeline #1786 passed with stage
in 15 minutes and 1 second
# -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-06-15 12:13
from __future__ import unicode_literals
from django.conf import settings
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [migrations.swappable_dependency(settings.AUTH_USER_MODEL)]
operations = [
migrations.CreateModel(
name="EducationDepartment",
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
)
],
),
migrations.CreateModel(
name="StudyField",
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
)
],
),
migrations.CreateModel(
name="UV",
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
(
"code",
models.CharField(
max_length=10,
unique=True,
validators=[
django.core.validators.RegexValidator(
message="The code of an UV must only contains uppercase characters without accent and numbers",
regex="([A-Z0-9]+)",
)
],
verbose_name="code",
),
),
(
"credit_type",
models.CharField(
choices=[
("FREE", "Free"),
("CS", "CS"),
("TM", "TM"),
("EC", "EC"),
("CG", "CG"),
("RN", "RN"),
("EXT", "EXT"),
],
default="FREE",
max_length=10,
verbose_name="credit type",
),
),
(
"semester",
models.CharField(
choices=[
("CLOSED", "Closed"),
("AUTUMN", "Autumn"),
("SPRING", "Spring"),
("AUTOMN_AND_SPRING", "Autumn and spring"),
],
default="CLOSED",
max_length=10,
verbose_name="semester",
),
),
(
"language",
models.CharField(
choices=[
("FR", "French"),
("EN", "English"),
("DE", "German"),
("SP", "Spanich"),
],
default="FR",
max_length=10,
verbose_name="language",
),
),
(
"credits",
models.IntegerField(
validators=[django.core.validators.MinValueValidator(0)],
verbose_name="credits",
),
),
("title", models.CharField(max_length=300, verbose_name="title")),
(
"manager",
models.CharField(max_length=300, verbose_name="uv manager"),
),
("objectives", models.TextField(verbose_name="objectives")),
("program", models.TextField(verbose_name="program")),
("skills", models.TextField(verbose_name="skills")),
("key_concepts", models.TextField(verbose_name="key_concepts")),
(
"hours_CM",
models.IntegerField(
validators=[django.core.validators.MinValueValidator(0)],
verbose_name="hours CM",
),
),
(
"hours_TD",
models.IntegerField(
validators=[django.core.validators.MinValueValidator(0)],
verbose_name="hours TD",
),
),
(
"hours_TP",
models.IntegerField(
validators=[django.core.validators.MinValueValidator(0)],
verbose_name="hours TP",
),
),
(
"hours_THE",
models.IntegerField(
validators=[django.core.validators.MinValueValidator(0)],
verbose_name="hours THE",
),
),
(
"hours_TE",
models.IntegerField(
validators=[django.core.validators.MinValueValidator(0)],
verbose_name="hours TE",
),
),
(
"author",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="created_UVs",
to=settings.AUTH_USER_MODEL,
verbose_name="created UVs",
),
),
(
"moderator",
models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.CASCADE,
related_name="moderated_UVs",
to=settings.AUTH_USER_MODEL,
verbose_name="moderated UVs",
),
),
],
),
migrations.CreateModel(
name="UVComment",
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
)
],
),
migrations.CreateModel(
name="UVCommentReport",
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
)
],
),
]
......@@ -23,6 +23,11 @@
#
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.core import validators
from django.conf import settings
from core.models import User
# Create your models here.
......@@ -32,7 +37,101 @@ class UV(models.Model):
Contains infos about an UV (course)
"""
pass
code = models.CharField(
_("code"),
max_length=10,
unique=True,
validators=[
validators.RegexValidator(
regex="([A-Z0-9]+)",
message=_(
"The code of an UV must only contains uppercase characters without accent and numbers"
),
)
],
)
moderator = models.ForeignKey(
User,
related_name="moderated_UVs",
verbose_name=_("moderated UVs"),
null=True,
blank=True,
)
author = models.ForeignKey(
User,
related_name="created_UVs",
verbose_name=_("created UVs"),
null=False,
blank=False,
)
credit_type = models.CharField(
_("credit type"),
max_length=10,
choices=settings.SITH_PEDAGOGY_UV_TYPE,
default=settings.SITH_PEDAGOGY_UV_TYPE[0][0],
)
manager = models.CharField(_("uv manager"), max_length=300)
semester = models.CharField(
_("semester"),
max_length=10,
choices=settings.SITH_PEDAGOGY_UV_SEMESTER,
default=settings.SITH_PEDAGOGY_UV_SEMESTER[0][0],
)
language = models.CharField(
_("language"),
max_length=10,
choices=settings.SITH_PEDAGOGY_UV_LANGUAGE,
default=settings.SITH_PEDAGOGY_UV_LANGUAGE[0][0],
)
credits = models.IntegerField(
_("credits"),
validators=[validators.MinValueValidator(0)],
blank=False,
null=False,
)
# Double star type not implemented yet
# Departments not implemented yet
# All texts about the UV
title = models.CharField(_("title"), max_length=300)
manager = models.CharField(_("uv manager"), max_length=300)
objectives = models.TextField(_("objectives"))
program = models.TextField(_("program"))
skills = models.TextField(_("skills"))
key_concepts = models.TextField(_("key_concepts"))
# Hours types CM, TD, TP, THE and TE
# Kind of dirty but I have nothing else in mind for now
hours_CM = models.IntegerField(
_("hours CM"),
validators=[validators.MinValueValidator(0)],
blank=False,
null=False,
)
hours_TD = models.IntegerField(
_("hours TD"),
validators=[validators.MinValueValidator(0)],
blank=False,
null=False,
)
hours_TP = models.IntegerField(
_("hours TP"),
validators=[validators.MinValueValidator(0)],
blank=False,
null=False,
)
hours_THE = models.IntegerField(
_("hours THE"),
validators=[validators.MinValueValidator(0)],
blank=False,
null=False,
)
hours_TE = models.IntegerField(
_("hours TE"),
validators=[validators.MinValueValidator(0)],
blank=False,
null=False,
)
class UVComment(models.Model):
......
......@@ -404,6 +404,30 @@ SITH_COUNTER_BANK = [
("LA-POSTE", "La Poste"),
]
SITH_PEDAGOGY_UV_TYPE = [
("FREE", _("Free")),
("CS", _("CS")),
("TM", _("TM")),
("EC", _("EC")),
("CG", _("CG")),
("RN", _("RN")),
("EXT", _("EXT")),
]
SITH_PEDAGOGY_UV_SEMESTER = [
("CLOSED", _("Closed")),
("AUTUMN", _("Autumn")),
("SPRING", _("Spring")),
("AUTOMN_AND_SPRING", _("Autumn and spring")),
]
SITH_PEDAGOGY_UV_LANGUAGE = [
("FR", _("French")),
("EN", _("English")),
("DE", _("German")),
("SP", _("Spanich")),
]
SITH_ECOCUP_CONS = 1152
SITH_ECOCUP_DECO = 1151
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment