feat: add field 'gender' to User model
This commit is contained in:
parent
a5d0edc4bd
commit
24c5b68b6b
18
accounts/migrations/0019_user_gender.py
Normal file
18
accounts/migrations/0019_user_gender.py
Normal 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),
|
||||||
|
),
|
||||||
|
]
|
||||||
@ -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(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user