Commit df416dc6 authored by Roshan Rabinarayan's avatar Roshan Rabinarayan

changed modesl

parent 367be50c
No preview for this file type
# Generated by Django 2.2.7 on 2020-10-24 07:25
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('quiz', '0005_auto_20201020_0755'),
]
operations = [
migrations.CreateModel(
name='quiz',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('quizId', models.CharField(max_length=100)),
('startTime', models.DateTimeField(auto_now_add=True)),
('length', models.FloatField(max_length=10)),
('quizCode', models.CharField(max_length=100)),
('quizDone', models.BooleanField(default=False)),
],
),
]
...@@ -18,7 +18,7 @@ class Questions(models.Model): ...@@ -18,7 +18,7 @@ class Questions(models.Model):
questionId=models.AutoField(primary_key=True,) questionId=models.AutoField(primary_key=True,)
class submission(models.Model): class submission(models.Model):
#submission( questionid,selectedoption, quizid, studentid)
questionId=models.CharField(max_length=100) questionId=models.CharField(max_length=100)
option=models.CharField(max_length=100) option=models.CharField(max_length=100)
studentId=models.CharField(max_length=100) studentId=models.CharField(max_length=100)
...@@ -29,3 +29,11 @@ class cribs(models.Model): ...@@ -29,3 +29,11 @@ class cribs(models.Model):
cribs=models.CharField(max_length=1000) cribs=models.CharField(max_length=1000)
quizId=models.CharField(max_length=100) quizId=models.CharField(max_length=100)
questionId=models.CharField(max_length=100) questionId=models.CharField(max_length=100)
class quiz(models.Model):
quizId=models.CharField(max_length=100) #primary key
startTime=models.DateTimeField(auto_now_add=True)
length=models.FloatField(max_length=10)
quizCode=models.CharField(max_length=100)
quizDone=models.BooleanField(default=False)
...@@ -36,6 +36,7 @@ def index(request): ...@@ -36,6 +36,7 @@ def index(request):
questions=paginator.page(paginator.num_pages) """ questions=paginator.page(paginator.num_pages) """
return render(request,'index.html',{'questions':obj,'count':count}) return render(request,'index.html',{'questions':obj,'count':count})
#quiz started #quiz completed.
def result(request): def result(request):
...@@ -94,7 +95,7 @@ def upload(request): ...@@ -94,7 +95,7 @@ def upload(request):
@login_required @login_required
def student(request): def student(request):
lst.clear()
return render(request,'student.html') return render(request,'student.html')
def upload_file(request): def upload_file(request):
...@@ -118,12 +119,13 @@ def handle_uploaded_file(f): ...@@ -118,12 +119,13 @@ def handle_uploaded_file(f):
destination=open("name.csv","r") destination=open("name.csv","r")
rows=readCSV(destination) rows=readCSV(destination)
for row in rows: for row in rows:
print(str(row))
q=Questions(question=row[0],option1=row[1],option2=row[2],option3=row[3],option4=row[4],answer=row[5],type=row[6],marks=int(row[7]),negative=float(row[8]),explainations=row[9],quizId=row[10]) q=Questions(question=row[0],option1=row[1],option2=row[2],option3=row[3],option4=row[4],answer=row[5],type=row[6],marks=int(row[7]),negative=float(row[8]),explainations=row[9],quizId=row[10])
q.save() q.save()
#login functionality #login functionality
def sign_up(request): def sign_up(request):
context = {} context = {}
...@@ -136,3 +138,7 @@ def sign_up(request): ...@@ -136,3 +138,7 @@ def sign_up(request):
context['form']=form context['form']=form
return render(request,'registration/signup.html',context) return render(request,'registration/signup.html',context)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment