2023-06-26 19:19:38 +08:00
|
|
|
from django.contrib.auth.models import AbstractUser
|
2023-06-26 19:10:04 +08:00
|
|
|
from django.db import models
|
|
|
|
|
2023-06-26 19:19:38 +08:00
|
|
|
|
|
|
|
class CustomUser(AbstractUser):
|
2023-06-26 20:36:58 +08:00
|
|
|
YEAR_LEVELS = (
|
|
|
|
('1st', '1st year'),
|
|
|
|
('2nd', '2nd year'),
|
|
|
|
('3rd', '3rd year'),
|
|
|
|
('4th', '4th year'),
|
|
|
|
('5th', '5th Year'),
|
|
|
|
('Irreg', 'Irregular'),
|
|
|
|
)
|
|
|
|
SEMESTERS = (
|
|
|
|
('1st', '1st semester'),
|
|
|
|
('2nd', '2nd semester'),
|
|
|
|
)
|
|
|
|
first_name = models.CharField(max_length=100)
|
|
|
|
last_name = models.CharField(max_length=100)
|
|
|
|
# Email inherited from base user class
|
|
|
|
# Username inherited from base user class
|
|
|
|
# Password inherited from base user class
|
|
|
|
# is_admin inherited from base user class
|
2023-06-26 19:19:38 +08:00
|
|
|
is_student = models.BooleanField(default=True)
|
2023-06-26 20:36:58 +08:00
|
|
|
is_studying = models.BooleanField(default=False)
|
2023-06-26 19:19:38 +08:00
|
|
|
is_banned = models.BooleanField(default=False)
|
2023-06-26 20:36:58 +08:00
|
|
|
year_level = models.CharField(
|
|
|
|
max_length=50, choices=YEAR_LEVELS)
|
|
|
|
semester = models.CharField(
|
|
|
|
max_length=50, choices=SEMESTERS)
|
2023-06-26 20:42:22 +08:00
|
|
|
avatar = models.ImageField(upload_to='media/avatars', null=True)
|
2023-06-26 19:45:58 +08:00
|
|
|
pass
|