feat: add field 'gender' to User model

This commit is contained in:
Zaki Benaissa 2024-01-31 22:18:45 +01:00
parent a5d0edc4bd
commit 24c5b68b6b
2 changed files with 24 additions and 0 deletions

View File

@ -0,0 +1,18 @@
# Generated by Django 4.0.8 on 2024-01-31 21:17
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('accounts', '0018_rename_department_student_program'),
]
operations = [
migrations.AddField(
model_name='user',
name='gender',
field=models.CharField(blank=True, choices=[('M', 'Male'), ('F', 'Female')], max_length=1, null=True),
),
]

View File

@ -55,11 +55,17 @@ class CustomUserManager(UserManager):
return queryset return queryset
GENDERS_CHOICES = (("M", "Male"), ("F", "Female"))
class User(AbstractUser): class User(AbstractUser):
is_student = models.BooleanField(default=False) is_student = models.BooleanField(default=False)
is_lecturer = models.BooleanField(default=False) is_lecturer = models.BooleanField(default=False)
is_parent = models.BooleanField(default=False) is_parent = models.BooleanField(default=False)
is_dep_head = models.BooleanField(default=False) is_dep_head = models.BooleanField(default=False)
gender = models.CharField(
max_length=1, choices=GENDERS_CHOICES, blank=True, null=True
)
phone = models.CharField(max_length=60, blank=True, null=True) phone = models.CharField(max_length=60, blank=True, null=True)
address = models.CharField(max_length=60, blank=True, null=True) address = models.CharField(max_length=60, blank=True, null=True)
picture = models.ImageField( picture = models.ImageField(