quiz/models.py
changeset 43 265ed367e8cc
parent 39 0fa055b8ea98
child 57 0ca5016cde82
equal deleted inserted replaced
42:007d87112911 43:265ed367e8cc
    25 
    25 
    26 class Answer(models.Model):
    26 class Answer(models.Model):
    27     """ A model for holding answers submitted by users.
    27     """ A model for holding answers submitted by users.
    28     """
    28     """
    29 
    29 
    30     question = models.ForeignKey(QuestionBank)
    30     question = models.ForeignKey(QuestionBank, related_name="%(class)s")
    31     submitted_ans = models.TextField()
    31     submitted_ans = models.TextField()
    32     is_correct = models.BooleanField(default=False)
    32     is_correct = models.BooleanField(default=False)
    33 
    33 
    34 class Quiz(models.Model):
    34 class Quiz(models.Model):
    35     """ A model to hold the proceeding of a quiz.
    35     """ A model to hold the proceeding of a quiz.
    40     user_ip = models.CharField(max_length=15)
    40     user_ip = models.CharField(max_length=15)
    41     key = models.CharField(max_length=10)
    41     key = models.CharField(max_length=10)
    42     
    42     
    43     quiz_num = models.CharField(max_length=2)
    43     quiz_num = models.CharField(max_length=2)
    44     que_remaining = models.CharField(max_length=100)
    44     que_remaining = models.CharField(max_length=100)
    45     que_answered = models.ManyToManyField(Answer)
    45     que_answered = models.ManyToManyField(Answer, related_name="%(class)s")
    46 
    46