From 31d1689a44003ec60d7760f8225c94cd85bbd5b2 Mon Sep 17 00:00:00 2001 From: Shreya2803 Date: Fri, 15 Dec 2023 11:53:45 +0530 Subject: [PATCH 1/2] User model updated with guest user and otherdetails --- backend/users/models.py | 54 ++++++++++++++++++++++++++++++++++-- backend/users/serializers.py | 14 ++++++++++ 2 files changed, 66 insertions(+), 2 deletions(-) diff --git a/backend/users/models.py b/backend/users/models.py index ab141b999..4b9049dd7 100644 --- a/backend/users/models.py +++ b/backend/users/models.py @@ -21,7 +21,7 @@ from organizations.models import Organization from workspaces.models import Workspace -from anudesh_backend import settings +from shoonya_backend import settings from dotenv import load_dotenv from .utils import hash_upload @@ -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 @@ -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 shoonya", f"Hello! Please click on the following link to reset your password - {link}", settings.DEFAULT_FROM_EMAIL, [email], diff --git a/backend/users/serializers.py b/backend/users/serializers.py index 414388300..e40f224b5 100644 --- a/backend/users/serializers.py +++ b/backend/users/serializers.py @@ -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", @@ -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", From 8a617bf4b24fe34884096883ba530b5cb24d0524 Mon Sep 17 00:00:00 2001 From: Shreya2803 Date: Fri, 15 Dec 2023 12:01:12 +0530 Subject: [PATCH 2/2] Changeshoonya to Anudesh --- backend/users/models.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/users/models.py b/backend/users/models.py index 4b9049dd7..cf1a1b166 100644 --- a/backend/users/models.py +++ b/backend/users/models.py @@ -21,7 +21,7 @@ from organizations.models import Organization from workspaces.models import Workspace -from shoonya_backend import settings +from anudesh_backend import settings from dotenv import load_dotenv from .utils import hash_upload @@ -311,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 shoonya", + "Reset password link for Anudesh", f"Hello! Please click on the following link to reset your password - {link}", settings.DEFAULT_FROM_EMAIL, [email],