diff options
author | Akshen | 2018-10-10 10:50:20 +0530 |
---|---|---|
committer | Akshen | 2018-10-10 10:50:20 +0530 |
commit | bed6d3bec534ec5cd207e1fa00580749aaa14112 (patch) | |
tree | 8c13a8cd762971e86bb39a95029eb2a16784ded0 /website/models.py | |
parent | 63bde864f757953faed546a537bc8ea77d3e3de2 (diff) | |
download | nccps-2018-bed6d3bec534ec5cd207e1fa00580749aaa14112.tar.gz nccps-2018-bed6d3bec534ec5cd207e1fa00580749aaa14112.tar.bz2 nccps-2018-bed6d3bec534ec5cd207e1fa00580749aaa14112.zip |
Add DWSIM Online Quiz
- Moderator can add, edit questions and view leaderboard
- Participant can take quiz specified for that day
Diffstat (limited to 'website/models.py')
-rw-r--r-- | website/models.py | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/website/models.py b/website/models.py index 7906960..2481177 100644 --- a/website/models.py +++ b/website/models.py @@ -1,9 +1,12 @@ from django.db import models from django.contrib.auth.models import User +from django.utils import timezone +from datetime import datetime, timedelta from social.apps.django_app.default.models import UserSocialAuth from nccps2018 import settings from django.core.validators import RegexValidator import os +import pytz position_choices = ( ("student", "Student"), @@ -98,7 +101,26 @@ class Profile(models.Model): self.user.last_name, self.user.email ) - - + + +class Question(models.Model): + + question = models.TextField() + option_1 = models.CharField(max_length=255) + option_2 = models.CharField(max_length=255) + option_3 = models.CharField(max_length=255) + option_4 = models.CharField(max_length=255) + correct_answer = models.CharField(max_length=255, + help_text='please write it as written in the option \ + above(Case-sensitive)') -
\ No newline at end of file + # The date for the question. + question_day = models.DateField() + + +class AnswerPaper(models.Model): + + participant = models.ForeignKey(Profile, on_delete=models.CASCADE) + answered_q = models.ForeignKey(Question, on_delete=models.CASCADE) + validate_ans = models.BooleanField() + date = models.DateTimeField(auto_now=True)
\ No newline at end of file |