sonar issues fixed

This commit is contained in:
jain
2023-07-17 11:58:04 +05:30
parent 32e52e17f4
commit cfc36735d6
10 changed files with 190 additions and 71 deletions

View File

@ -10,45 +10,66 @@ from base.constants import GENDERS, SIGNUP_METHODS, RELATIONSHIP
"""Define User model"""
User = get_user_model()
# Create your models here.
# Define junior model with
# various fields like
# phone, country code,
# country name,
# gender,
# date of birth,
# profile image,
# relationship type of the guardian
# signup method,
# guardian code,
# junior code,
# referral code,
# referral code that used by the junior
# is invited junior
# profile is active or not
# profile is complete or not
# passcode
# junior is verified or not
"""Define junior points model"""
# points of the junior
# position of the junior
class Junior(models.Model):
"""Junior model"""
auth = models.ForeignKey(User, on_delete=models.CASCADE, related_name='junior_profile', verbose_name='Email')
"""Contact details"""
# Contact details"""
phone = models.CharField(max_length=31, null=True, blank=True, default=None)
country_code = models.IntegerField(blank=True, null=True)
"""country name of the guardian"""
# country name of the guardian"""
country_name = models.CharField(max_length=100, null=True, blank=True, default=None)
"""Personal info"""
# Personal info"""
gender = models.CharField(max_length=10, choices=GENDERS, null=True, blank=True, default=None)
"""Date of birth"""
# Date of birth"""
dob = models.DateField(max_length=15, null=True, blank=True, default=None)
"""Image of the junior"""
# Image of the junior"""
image = models.URLField(null=True, blank=True, default=None)
"""relationship"""
# relationship"""
relationship = models.CharField(max_length=31, choices=RELATIONSHIP, null=True, blank=True,
default='1')
"""Sign up method"""
# Sign up method"""
signup_method = models.CharField(max_length=31, choices=SIGNUP_METHODS, default='1')
"""Codes"""
# Codes"""
junior_code = models.CharField(max_length=10, null=True, blank=True, default=None)
"""Guardian Codes"""
# Guardian Codes"""
guardian_code = ArrayField(models.CharField(max_length=10, null=True, blank=True, default=None),null=True)
"""Referral code"""
# Referral code"""
referral_code = models.CharField(max_length=10, null=True, blank=True, default=None)
"""Referral code that is used by junior while signup"""
# Referral code that is used by junior while signup"""
referral_code_used = models.CharField(max_length=10, null=True, blank=True, default=None)
"""invited junior"""
# invited junior"""
is_invited = models.BooleanField(default=False)
"""Profile activity"""
# Profile activity"""
is_active = models.BooleanField(default=True)
"""junior profile is complete or not"""
# junior profile is complete or not"""
is_complete_profile = models.BooleanField(default=False)
"""passcode of the junior profile"""
# passcode of the junior profile"""
passcode = models.IntegerField(null=True, blank=True, default=None)
"""junior is verified or not"""
# junior is verified or not"""
is_verified = models.BooleanField(default=False)
"""Profile created and updated time"""
# Profile created and updated time"""
created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=True)
@ -56,7 +77,7 @@ class Junior(models.Model):
""" Meta class """
db_table = 'junior'
verbose_name = 'Junior'
"""another name of the model"""
# another name of the model"""
verbose_name_plural = 'Junior'
def __str__(self):
@ -66,11 +87,11 @@ class Junior(models.Model):
class JuniorPoints(models.Model):
"""Junior model"""
junior = models.OneToOneField(Junior, on_delete=models.CASCADE, related_name='junior_points')
"""Contact details"""
# Contact details"""
total_task_points = models.IntegerField(blank=True, null=True, default=0)
"""position of the junior"""
# position of the junior"""
position = models.IntegerField(blank=True, null=True, default=99999)
"""Profile created and updated time"""
# Profile created and updated time"""
created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=True)
@ -78,7 +99,7 @@ class JuniorPoints(models.Model):
""" Meta class """
db_table = 'junior_task_points'
verbose_name = 'Junior Task Points'
"""another name of the model"""
# another name of the model"""
verbose_name_plural = 'Junior Task Points'
def __str__(self):