mirror of
https://github.com/HamzaSha1/zod-backend.git
synced 2025-11-26 16:44:54 +00:00
junior article points table
This commit is contained in:
@ -9,7 +9,8 @@ from django.contrib.postgres.fields import ArrayField
|
||||
from base.constants import GENDERS, SIGNUP_METHODS, RELATIONSHIP
|
||||
# Import guardian's model
|
||||
from guardian.models import Guardian
|
||||
|
||||
# Import web admin's model
|
||||
from web_admin.models import SurveyOption, ArticleSurvey, Article
|
||||
"""Define User model"""
|
||||
User = get_user_model()
|
||||
# Create your models here.
|
||||
@ -137,3 +138,22 @@ class JuniorGuardianRelationship(models.Model):
|
||||
return f'{self.guardian.user}'
|
||||
|
||||
|
||||
class JuniorArticlePoints(models.Model):
|
||||
"""
|
||||
Survey Options model
|
||||
"""
|
||||
# associated junior with the task
|
||||
junior = models.ForeignKey(Junior, on_delete=models.CASCADE, related_name='juniors_details', verbose_name='Junior')
|
||||
article = models.ForeignKey(Article, on_delete=models.CASCADE, related_name='junior_articles')
|
||||
question = models.ForeignKey(ArticleSurvey, on_delete=models.CASCADE, related_name='questions')
|
||||
submitted_answer = models.ForeignKey(SurveyOption, on_delete=models.CASCADE, related_name='submitted_answer')
|
||||
# earn points"""
|
||||
earn_points = models.IntegerField(blank=True, null=True, default=5)
|
||||
is_attempt = models.BooleanField(default=False)
|
||||
is_answer_correct = models.BooleanField(default=False)
|
||||
created_at = models.DateTimeField(auto_now_add=True)
|
||||
updated_at = models.DateTimeField(auto_now=True)
|
||||
|
||||
def __str__(self):
|
||||
"""Return title"""
|
||||
return f'{self.id} | {self.question}'
|
||||
|
||||
Reference in New Issue
Block a user