quiz/models.py
changeset 57 0ca5016cde82
parent 43 265ed367e8cc
child 59 0b57494e8b4e
equal deleted inserted replaced
56:d8d4387b3281 57:0ca5016cde82
     1 from django.db import models
     1 from django.db import models
     2 from django.contrib.auth.models import User
     2 from django.contrib.auth.models import User
     3 
     3 
     4 from offline.event.models import Event
     4 from offline.event.models import Event
       
     5 
       
     6 TOPIC_CHOICES = (("11", "Plotting"),
       
     7                  ("12", "Lists and Files"),
       
     8                  ("13", "Strings"),
       
     9                  ("14", "Dictionaries and Piecharts"),
       
    10                  ("15", "Statistics"),
       
    11                  ("16", "Matrices"),
       
    12                  ("17", "Solving linear equations"),
       
    13                  ("18", "Finding roots"),
       
    14 
       
    15                  ("21", "Basic Datatypes"),
       
    16                  ("22", "Input and Output"),
       
    17                  ("23", "Lists and Tuples"),
       
    18                  ("24", "Dictionaries"),
       
    19                  ("25", "Sets"),
       
    20                  ("26", "Conditional Statements"),
       
    21                  ("27", "Functions"),
       
    22                  )
     5 
    23 
     6 class Profile(models.Model):
    24 class Profile(models.Model):
     7     """ A profile for quiz takers.
    25     """ A profile for quiz takers.
     8     """
    26     """
     9 
    27 
    13 
    31 
    14 class QuestionBank(models.Model):
    32 class QuestionBank(models.Model):
    15     """ A model for holding the database of questions.
    33     """ A model for holding the database of questions.
    16     """
    34     """
    17 
    35 
    18     quiz_num = models.CharField(max_length=2)
    36     quiz_num = models.CharField(max_length=2, default="00")
       
    37     topic = models.CharField(max_length=2,choices=TOPIC_CHOICES)
    19 
    38 
    20     description = models.TextField()
    39     description = models.TextField()
    21     code = models.TextField()
    40     code = models.TextField()
    22     options = models.TextField()
    41     options = models.TextField()
    23     time_limit = models.PositiveSmallIntegerField()
    42     time_limit = models.PositiveSmallIntegerField()