Skip to content

Commit

Permalink
Merge pull request #4 from AI4Bharat/user_model_changes
Browse files Browse the repository at this point in the history
User model updated with guest user and otherdetails
  • Loading branch information
KunalTiwary authored Dec 18, 2023
2 parents 61a75a4 + 8a617bf commit ce68ffe
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 1 deletion.
52 changes: 51 additions & 1 deletion backend/users/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,56 @@ class User(AbstractBaseUser, PermissionsMixin):
profile_photo = models.CharField(
verbose_name="profile_photo", max_length=256, blank=True
)
gender_choices = (
("M", "Male"),
("F", "Female"),
("O", "Other"),
)

gender = models.CharField(
verbose_name="gender",
choices=gender_choices,
max_length=1,
blank=True,
)
date_of_birth = models.DateField(
verbose_name="date_of_birth",
null=True,
blank=True,
)
address = models.TextField(
verbose_name="address",
blank=True,
)

city = models.CharField(
verbose_name="city",
max_length=255,
blank=True,
)

state = models.CharField(
verbose_name="state",
max_length=255,
blank=True,
)

pin_code = models.CharField(
verbose_name="Pin Code",
max_length=10,
blank=True,
)
GUEST_USER_CHOICES = [
(True, "Yes"),
(False, "No"),
]

guest_user = models.BooleanField(
verbose_name="guest_user",
default=False,
choices=GUEST_USER_CHOICES,
help_text="Indicates whether the user is a guest user.",
)

role = models.PositiveSmallIntegerField(
choices=ROLE_CHOICES, blank=False, null=False, default=ANNOTATOR
Expand Down Expand Up @@ -261,7 +311,7 @@ def send_mail_to_change_password(self, email, key):
link = f"{prefix}/#/forget-password/confirm/{key}/{sent_token}"
try:
send_mail(
"Reset password link for anudesh",
"Reset password link for Anudesh",
f"Hello! Please click on the following link to reset your password - {link}",
settings.DEFAULT_FROM_EMAIL,
[email],
Expand Down
14 changes: 14 additions & 0 deletions backend/users/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,13 @@ class Meta:
"languages",
"availability_status",
"phone",
"gender",
"date_of_birth",
"address",
"city",
"state",
"Pin Code",
"guest_user",
"enable_mail",
"participation_type",
"organization",
Expand All @@ -66,6 +73,13 @@ class Meta:
"first_name",
"last_name",
"phone",
"gender",
"date_of_birth",
"address",
"city",
"state",
"Pin Code",
"guest_user",
"profile_photo",
"role",
"organization",
Expand Down

0 comments on commit ce68ffe

Please sign in to comment.