Commit 68fd9019 authored by Roshan Rabinarayan's avatar Roshan Rabinarayan

added inputs to professor page

parent 24705899
No preview for this file type
# Generated by Django 3.1.2 on 2020-10-30 20:19
import datetime
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('quiz', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='quiz',
name='date',
field=models.DateField(default=datetime.date.today),
),
migrations.AddField(
model_name='quiz',
name='startTime',
field=models.DateTimeField(default=datetime.datetime(2020, 10, 30, 20, 19, 59, 786706)),
),
]
# Generated by Django 3.1.2 on 2020-10-30 20:26
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('quiz', '0002_auto_20201030_2019'),
]
operations = [
migrations.AlterField(
model_name='quiz',
name='startTime',
field=models.TimeField(auto_now=True),
),
]
from django.db import models from django.db import models
from django.contrib.auth.models import User from django.contrib.auth.models import User
import datetime
class quiz(models.Model): class quiz(models.Model):
quizId=models.AutoField(default=0, primary_key=True) #primary key quizId=models.AutoField(default=0, primary_key=True) #primary key
#startTime=models.DateTimeField(auto_now_add=True,default=datetime.datetime.now) #startTime=models.DateTimeField(auto_now_add=True,default=datetime.datetime.now)
#startTime=models.DateTimeField() startTime=models.TimeField(auto_now=True)
date=models.DateField(default=datetime.date.today)
length=models.FloatField(max_length=10) length=models.FloatField(max_length=10)
quizCode=models.CharField(max_length=100,default='Code') ##quiz Code set by instructor quizCode=models.CharField(max_length=100,default='Code') ##quiz Code set by instructor
quizDone=models.BooleanField(default=False) quizDone=models.BooleanField(default=False)
......
...@@ -5,7 +5,18 @@ ...@@ -5,7 +5,18 @@
action = "{% url "uploaded" %}" method = "POST" >{% csrf_token %} action = "{% url "uploaded" %}" method = "POST" >{% csrf_token %}
<label for="date">Quiz Date</label><br>
<input type="date" id="date" name="date"><br>
<label for="startTime">Start Time</label><br>
<input type="time" id="startTime" name="startTime"><br>
<label for="length">length</label><br>
<input type="number" id="length" name="length"><br>
<label for="quizCode">Quiz Code</label><br>
<input type="text" id="quizCode" name="quizCode"><br>
<label for="quizInfo">quiz Info</label><br>
<input type="textarea" id="quizInfo" name="quizInfo">
<input type="hidden" id="quizInstructor" name="quizInstructor" value ="Instructor"><!--set instructor id here-->
<br> <br>
<div style = "max-width:470px;"> <div style = "max-width:470px;">
......
...@@ -117,7 +117,8 @@ def student(request): ...@@ -117,7 +117,8 @@ def student(request):
def upload_file(request): def upload_file(request):
uploaded=False uploaded=False
temp1='test' temp1='test'
q= quiz(length=90,quizCode='abcd',quizDone=False) q= quiz(length=request.POST.get('length'),quizCode=request.POST.get('quizCode'),quizInfo=request.POST.get('quizInfo'),date=request.POST.get('date'),
quizInstructor=request.POST.get('quizInstructor'),startTime =request.POST.get('startTime'),quizDone=False)
q.save() q.save()
form = UploadFileForm(request.POST, request.FILES) form = UploadFileForm(request.POST, request.FILES)
if request.method == 'POST' and form.is_valid(): if request.method == 'POST' and form.is_valid():
......
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