courseInfo.py 1.08 KB
Newer Older
Stefan Vercillo's avatar
cli  
Stefan Vercillo committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
from models.base_model import BaseModel


class CourseInfo(BaseModel):

    __tablename__ = "courseInfo"

    course_offering_id = None
    course_offering_length_in_days = None
    semester = None
    year = None

    def __init__(
        self,
        course_offering_length_in_days=None,
        semester=None,
        year=None,
        skip_creation=False,
    ):
        self.course_offering_length_in_days = course_offering_length_in_days
        self.semester = semester
        self.year = year

        if not skip_creation:
            self._create_self(self)

    @staticmethod
    def _get_columns() -> list:
        return [
            "course_offering_length_in_days",
            "course_offering_id",
            "semester",
            "year",
        ]

    def __as_small_dict__(self):
        return {
            "course_offering_id": self.course_offering_id,
        }

    def __repr__(self):
        return f"< CourseOfferings course_offering_id {self.course_offering_id} >"

    def __str__(self):
        return f"< CourseOfferings course_offering_id {self.course_offering_id} >"