2023-03-21 21:22:14 +08:00
|
|
|
from django.db import models
|
|
|
|
from django.core.validators import MaxValueValidator, MinValueValidator
|
2023-04-11 23:20:01 +08:00
|
|
|
from django.utils.timezone import now
|
2023-03-21 21:22:14 +08:00
|
|
|
# Create your models here.
|
|
|
|
|
|
|
|
|
|
|
|
class Subject(models.Model):
|
2023-03-21 21:50:54 +08:00
|
|
|
class YearLevels(models.TextChoices):
|
2023-04-22 00:54:00 +08:00
|
|
|
FIRST_YEAR = '1st Year'
|
|
|
|
SECOND_YEAR = '2nd Year'
|
|
|
|
THIRD_YEAR = '3rd Year'
|
|
|
|
FOURTH_YEAR = '4th Year'
|
2023-03-21 21:50:54 +08:00
|
|
|
|
2023-03-21 21:59:09 +08:00
|
|
|
class Semesters(models.TextChoices):
|
2023-04-22 11:00:04 +08:00
|
|
|
FIRST_SEM = '1st Semester'
|
|
|
|
SECOND_SEM = '2nd Semester'
|
2023-03-21 21:59:09 +08:00
|
|
|
|
2023-03-21 21:22:14 +08:00
|
|
|
name = models.CharField(max_length=40)
|
2023-04-22 11:00:04 +08:00
|
|
|
code = models.CharField(max_length=20)
|
2023-03-21 21:22:14 +08:00
|
|
|
max_slots = models.IntegerField(default=60)
|
2023-03-21 21:50:54 +08:00
|
|
|
year_level = models.CharField(max_length=20, choices=YearLevels.choices)
|
2023-03-21 21:59:09 +08:00
|
|
|
semester = models.CharField(
|
|
|
|
max_length=20, choices=Semesters.choices, default=Semesters.FIRST_SEM)
|
2023-03-21 21:22:14 +08:00
|
|
|
|
|
|
|
def __str__(self):
|
|
|
|
return self.name
|