pedagogy: models for UVComment and UVResult

This commit is contained in:
Antoine Bartuccio 2019-06-16 15:37:25 +02:00
parent 598cdc0284
commit b7c2da53fe
Signed by: klmp200
GPG Key ID: E7245548C53F904B
3 changed files with 214 additions and 5 deletions

View File

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-06-15 15:00
# Generated by Django 1.11.20 on 2019-06-16 13:36
from __future__ import unicode_literals
from django.conf import settings
@ -176,7 +176,7 @@ class Migration(migrations.Migration):
"author",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="created_UVs",
related_name="uv_created",
to=settings.AUTH_USER_MODEL,
verbose_name="author",
),
@ -194,7 +194,76 @@ class Migration(migrations.Migration):
serialize=False,
verbose_name="ID",
),
)
),
("comment", models.TextField(verbose_name="comment")),
(
"grade_global",
models.IntegerField(
default=-1,
validators=[
django.core.validators.MinValueValidator(-1),
django.core.validators.MaxValueValidator(5),
],
verbose_name="global grade",
),
),
(
"grade_utility",
models.IntegerField(
default=-1,
validators=[
django.core.validators.MinValueValidator(-1),
django.core.validators.MaxValueValidator(5),
],
verbose_name="utility grade",
),
),
(
"grade_interest",
models.IntegerField(
default=-1,
validators=[
django.core.validators.MinValueValidator(-1),
django.core.validators.MaxValueValidator(5),
],
verbose_name="interest grade",
),
),
(
"grade_teaching",
models.IntegerField(
default=-1,
validators=[
django.core.validators.MinValueValidator(-1),
django.core.validators.MaxValueValidator(5),
],
verbose_name="teaching grade",
),
),
(
"grade_work_load",
models.IntegerField(
default=-1,
validators=[
django.core.validators.MinValueValidator(-1),
django.core.validators.MaxValueValidator(5),
],
verbose_name="work load grade",
),
),
(
"publish_date",
models.DateField(auto_now=True, verbose_name="publish date"),
),
(
"author",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="uv_comments",
to=settings.AUTH_USER_MODEL,
verbose_name="author",
),
),
],
),
migrations.CreateModel(
@ -211,4 +280,64 @@ class Migration(migrations.Migration):
)
],
),
migrations.CreateModel(
name="UVResult",
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
(
"grade",
models.CharField(
choices=[
("A", "A"),
("B", "B"),
("C", "C"),
("D", "D"),
("E", "E"),
("FX", "FX"),
("F", "F"),
("ABS", "Abs"),
],
default="A",
max_length=10,
verbose_name="grade",
),
),
(
"semester",
models.CharField(
max_length=5,
validators=[
django.core.validators.RegexValidator("[AP][0-9]{3}")
],
verbose_name="semester",
),
),
(
"user",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="uv_results",
to=settings.AUTH_USER_MODEL,
verbose_name="user",
),
),
(
"uv",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="results",
to="pedagogy.UV",
verbose_name="uv",
),
),
],
),
]

View File

@ -67,7 +67,7 @@ class UV(models.Model):
)
author = models.ForeignKey(
User,
related_name="created_UVs",
related_name="uv_created",
verbose_name=_("author"),
null=False,
blank=False,
@ -152,7 +152,76 @@ class UVComment(models.Model):
A comment about an UV
"""
pass
author = models.ForeignKey(
User,
related_name="uv_comments",
verbose_name=_("author"),
null=False,
blank=False,
)
comment = models.TextField(_("comment"))
grade_global = models.IntegerField(
_("global grade"),
validators=[validators.MinValueValidator(-1), validators.MaxValueValidator(5)],
blank=False,
null=False,
default=-1,
)
grade_utility = models.IntegerField(
_("utility grade"),
validators=[validators.MinValueValidator(-1), validators.MaxValueValidator(5)],
blank=False,
null=False,
default=-1,
)
grade_interest = models.IntegerField(
_("interest grade"),
validators=[validators.MinValueValidator(-1), validators.MaxValueValidator(5)],
blank=False,
null=False,
default=-1,
)
grade_teaching = models.IntegerField(
_("teaching grade"),
validators=[validators.MinValueValidator(-1), validators.MaxValueValidator(5)],
blank=False,
null=False,
default=-1,
)
grade_work_load = models.IntegerField(
_("work load grade"),
validators=[validators.MinValueValidator(-1), validators.MaxValueValidator(5)],
blank=False,
null=False,
default=-1,
)
publish_date = models.DateField(_("publish date"), auto_now=True)
class UVResult(models.Model):
"""
Results got to an UV
Views will be implemented after the first release
Will list every UV done by an user
Linked to user
uv
Contains a grade settings.SITH_PEDAGOGY_UV_RESULT_GRADE
a semester (P/A)20xx
"""
uv = models.ForeignKey(UV, related_name="results", verbose_name=_("uv"))
user = models.ForeignKey(User, related_name="uv_results", verbose_name=("user"))
grade = models.CharField(
_("grade"),
max_length=10,
choices=settings.SITH_PEDAGOGY_UV_RESULT_GRADE,
default=settings.SITH_PEDAGOGY_UV_RESULT_GRADE[0][0],
)
semester = models.CharField(
_("semester"),
max_length=5,
validators=[validators.RegexValidator("[AP][0-9]{3}")],
)
class UVCommentReport(models.Model):

View File

@ -431,6 +431,17 @@ SITH_PEDAGOGY_UV_LANGUAGE = [
("SP", _("Spanich")),
]
SITH_PEDAGOGY_UV_RESULT_GRADE = [
("A", _("A")),
("B", _("B")),
("C", _("C")),
("D", _("D")),
("E", _("E")),
("FX", _("FX")),
("F", _("F")),
("ABS", _("Abs")),
]
SITH_ECOCUP_CONS = 1152
SITH_ECOCUP_DECO = 1151