Darkolius

Untitled

Jun 9th, 2020
300
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.89 KB | None | 0 0
  1. from django.db import models
  2.  
  3.  
  4. class ExamTemplate(models.Model):
  5.     id = models.AutoField(primary_key=True)
  6.     title = models.CharField(max_length=100)
  7.     subject = models.CharField(max_length=100)
  8.  
  9.     def __str__(self):
  10.         return self.title
  11.  
  12.  
  13. class Exam(models.Model):
  14.     id = models.AutoField(primary_key=True)
  15.     date_and_time = models.DateTimeField(blank=False)
  16.     location = models.CharField(max_length=100)
  17.     is_results = models.BooleanField(default=False)
  18.     exam_template = models.ManyToManyField(ExamTemplate)
  19.  
  20.     def __str__(self):
  21.         return f'{self.date_and_time} {self.location}'
  22.  
  23.  
  24. class Exercise(models.Model):
  25.     id = models.AutoField(primary_key=True)
  26.     question = models.CharField(max_length=500)
  27.     max_points = models.IntegerField(default=3)
  28.     exam = models.ManyToManyField(Exam)
  29.  
  30.     def __str__(self):
  31.         return self.question
Advertisement
Add Comment
Please, Sign In to add comment