sonar issues

This commit is contained in:
jain
2023-07-14 12:05:28 +05:30
parent 5d528b885a
commit 7b9b5a2c6f
11 changed files with 77 additions and 48 deletions

View File

@ -4,6 +4,7 @@ from django.db import models
from django.contrib.auth import get_user_model
"""Import Django app"""
from base.constants import GENDERS, TASK_STATUS, PENDING, TASK_POINTS, SIGNUP_METHODS
"""import Junior model"""
from junior.models import Junior
"""Add user model"""
User = get_user_model()
@ -15,23 +16,31 @@ class Guardian(models.Model):
"""Contact details"""
country_code = models.IntegerField(blank=True, null=True)
phone = models.CharField(max_length=31, null=True, blank=True, default=None)
"""country name of the guardian"""
country_name = models.CharField(max_length=100, null=True, blank=True, default=None)
"""Image info"""
image = models.URLField(null=True, blank=True, default=None)
"""Personal info"""
family_name = models.CharField(max_length=50, null=True, blank=True, default=None)
"""gender of the guardian"""
gender = models.CharField(choices=GENDERS, max_length=15, null=True, blank=True, default=None)
"""date of birth of the guardian"""
dob = models.DateField(max_length=15, null=True, blank=True, default=None)
"""Profile activity"""
is_active = models.BooleanField(default=True)
"""guardian is verified or not"""
is_verified = models.BooleanField(default=False)
"""guardian profile is complete or not"""
is_complete_profile = models.BooleanField(default=False)
"""passcode of the guardian profile"""
passcode = models.IntegerField(null=True, blank=True, default=None)
"""Sign up method"""
signup_method = models.CharField(max_length=31, choices=SIGNUP_METHODS, default='1')
"""Codes"""
"""Guardian Codes"""
guardian_code = models.CharField(max_length=10, null=True, blank=True, default=None)
"""Referral code"""
referral_code = models.CharField(max_length=10, null=True, blank=True, default=None)
"""Referral code that is used by guardian while signup"""
referral_code_used = models.CharField(max_length=10, null=True, blank=True, default=None)
"""Profile created and updated time"""
created_at = models.DateTimeField(auto_now_add=True)
@ -40,7 +49,10 @@ class Guardian(models.Model):
class Meta(object):
""" Meta class """
db_table = 'guardians'
"""verbose name of the model"""
verbose_name = 'Guardian'
"""change another name"""
verbose_name_plural = 'Guardian'
def __str__(self):
"""Return email id"""
@ -51,19 +63,23 @@ class JuniorTask(models.Model):
guardian = models.ForeignKey(Guardian, on_delete=models.CASCADE, related_name='guardian', verbose_name='Guardian')
"""task details"""
task_name = models.CharField(max_length=100)
"""task description"""
task_description = models.CharField(max_length=500)
"""points of the task"""
points = models.IntegerField(default=TASK_POINTS)
"""last date of the task"""
due_date = models.DateField(auto_now_add=False, null=True, blank=True)
"""Images of task"""
"""Images of task that is upload by guardian"""
default_image = models.URLField(null=True, blank=True, default=None)
"""image that is uploaded by junior"""
image = models.URLField(null=True, blank=True, default=None)
"""associated junior with the task"""
junior = models.ForeignKey(Junior, on_delete=models.CASCADE, related_name='junior', verbose_name='Junior')
"""task status"""
task_status = models.CharField(choices=TASK_STATUS, max_length=15, default=PENDING)
"""task stage"""
"""task is active or not"""
is_active = models.BooleanField(default=True)
"""Task is approved or not"""
is_approved = models.BooleanField(default=False)
"""Profile created and updated time"""
created_at = models.DateTimeField(auto_now_add=True)
@ -72,7 +88,9 @@ class JuniorTask(models.Model):
class Meta(object):
""" Meta class """
db_table = 'junior_task'
"""verbose name of the model"""
verbose_name = 'Junior Task'
verbose_name_plural = 'Junior Task'
def __str__(self):
"""Return email id"""