Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from django.db import models
- from django.utils import timezone
- # A quiz model
- class Quiz(models.Model):
- title = models.CharField(max_length = 30)
- date_created = models.DateField()
- subject = models.CharField(max_length = 20)
- creator = models.ForeignKey(Teacher)
- def submit(self):
- self.submit_date = timezone.now()
- self.save()
- class Questions(models.Model):
- # Each question is associated with a specific quiz
- quiz = models.ForeignKey(Quiz)
- questionText = models.TextField()
- class Answer(models.Model):
- # Each answer is associated with a question
- possible_answer = models.ForeignKey(Questions)
- # Each question should also have an associated Boolean field
- correct_answer = models.BooleanField
- answerText = models.TextField()
- class Results(models.Model):
- quiz = models.ForeignKey(Quiz)
- student = models.ForeignKey(Student)
- score = models.IntegerField()
- # A student model
- class Student(models.Model):
- first_name = models.CharField(max_length = 30)
- last_name = models.CharField(max_length = 30)
- grade = models.IntegerField()
- teacher = models.ForeignKey(Teacher)
- # A teacher model
- class Teacher(models.Model):
- first_name = models.CharField(max_length = 30)
- last_name = models.CharField(max_length = 30)
- # Each teacher is associated with a principal
- principal = models.ForeignKey(Principal)
- # A staff model? including the principal
- class Principal(models.Model):
- first_name = models.CharField(max_length = 30)
- last_name = models.CharField(max_length = 30)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement