courseFeedback.py 1.21 KB
Newer Older
1
from django.core.validators import MaxValueValidator, MinValueValidator
2
from django.db import models
3

4
5
from backend_app.models.abstract.essentialModule import EssentialModule
from backend_app.models.course import Course
Segolene Brisemeur's avatar
Segolene Brisemeur committed
6
from backend_app.models.language import Language
7
from backend_app.permissions.moderation import ModerationLevels
8
9
10


class CourseFeedback(EssentialModule):
11
12
    moderation_level = ModerationLevels.DEPENDING_ON_SITE_SETTINGS

13
14
15
    course = models.OneToOneField(
        Course, on_delete=models.CASCADE, default=0, related_name="course_feedback"
    )
Segolene Brisemeur's avatar
Segolene Brisemeur committed
16
17
18
    language = models.ForeignKey(
        Language, on_delete=models.SET_NULL, related_name="courses", null=True
    )
19
20
    comment = models.TextField(null=True, max_length=1500)
    adequation = models.IntegerField(
21
        default=0, validators=[MinValueValidator(-5), MaxValueValidator(5)]
22
    )
23
24
25
    would_recommend = models.IntegerField(
        default=0, validators=[MinValueValidator(-5), MaxValueValidator(5)]
    )
26
    working_dose = models.IntegerField(
27
        default=0, validators=[MinValueValidator(-5), MaxValueValidator(5)]
28
    )
29
    following_ease = models.IntegerField(
30
        default=0, validators=[MinValueValidator(-5), MaxValueValidator(5)]
31
    )