InfoTech-Backend/infotech/subjects/models.py

25 lines
770 B
Python
Raw Normal View History

2023-03-21 21:22:14 +08:00
from django.db import models
from django.core.validators import MaxValueValidator, MinValueValidator
# Create your models here.
class Subject(models.Model):
2023-03-21 21:50:54 +08:00
class YearLevels(models.TextChoices):
FIRST_YEAR = 'IU-Y1', '1st Year'
SECOND_YEAR = 'IU-Y2', '2nd Year'
THIRD_YEAR = 'IU-Y3', '3rd Year'
FOURTH_YEAR = 'IU-Y4', '4th Year'
2023-03-21 21:22:14 +08:00
name = models.CharField(max_length=40)
enrolled_count = models.IntegerField(
default=0,
validators=[
MaxValueValidator(60),
MinValueValidator(0)
])
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:22:14 +08:00
def __str__(self):
return self.name