Commit 358610d6 authored by CHINTHAREDDY SAI CHARITH REDDY's avatar CHINTHAREDDY SAI CHARITH REDDY

personal tests

parents b31d9caa 8d3997dd
{
"python.pythonPath": "/usr/bin/python",
"python.linting.pylintEnabled": true,
"python.linting.pylamaEnabled": false,
"python.linting.enabled": true,
"python.jediEnabled": false
}
\ No newline at end of file
python3
\ No newline at end of file
/usr/bin/python3
\ No newline at end of file
# -*- coding: utf-8 -*-
# Generated by Django 1.11.16 on 2018-11-06 21:27
# Generated by Django 1.11.16 on 2018-11-24 13:16
from __future__ import unicode_literals
import django.core.validators
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
// This file is autogenerated via the `commonjs` Grunt task. You can require() this file in a CommonJS environment.
require('../../js/transition.js')
require('../../js/alert.js')
require('../../js/button.js')
require('../../js/carousel.js')
require('../../js/collapse.js')
require('../../js/dropdown.js')
require('../../js/modal.js')
require('../../js/tooltip.js')
require('../../js/popover.js')
require('../../js/scrollspy.js')
require('../../js/tab.js')
require('../../js/affix.js')
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
......@@ -29,13 +29,16 @@ Create Test
<form method="POST" action="create_Test">
{% csrf_token %}
{{ TestForm }}
{{TestForm.errors}}
{{TestForm.non_field_errors}}
{%for question in questions%}
<li class="list-group-item">
<!-- <li> -->
<input type="checkbox" value= "True" name = "{{question.q_id}}" >
<div class="row toggle">
<div class="col-xs-10">
<input type="checkbox" value= "True" name = "{{question.q_id}}" >
{{question.question_text}} </br>
{{question.question_text}} {{question.q_id}} </br>
</div>
</div>
<div>
......@@ -54,8 +57,8 @@ Create Test
{%endfor%}
<label> marks
<input type="number" name="{{question.q_id}}" min="0" max="10" placeholder="4" step="0.25" value="4">
<input type="number" name="{{question.q_id}}" min="-10" max="0" placeholder="-1" step="0.25" value="0">
<input type="number" name="{{question.q_id}}1" min="0" max="10" placeholder="4" step="0.25" value="4">
<input type="number" name="{{question.q_id}}2" min="-10" max="0" placeholder="-1" step="0.25" value="0">
</label>
</ul>
......
......@@ -5,9 +5,9 @@ profile
{%endblock%}
{%block head%}
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/js/bootstrap.min.js"></script>
<script src="//code.jquery.com/jquery-1.11.1.min.js"></script>
<!-- <link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> -->
<!-- <script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/js/bootstrap.min.js"></script> -->
<!-- <script src="//code.jquery.com/jquery-1.11.1.min.js"></script> -->
{% load static %}
<link rel="stylesheet" href="{% static 'ARFA_app/home.css' %}" type="text/css">
......@@ -233,7 +233,7 @@ profile
</p>
<!-- <button type="button" class="btn btn-login float-right">Load Test</button> -->
<button type="button" class="btn btn-login float-right">Load Test</button> -->
<h2>
-->
......
......@@ -46,11 +46,11 @@ profile
});
</script>
<script type='text/javascript'>
<!-- <script type='text/javascript'>
function preventBack(){window.history.forward();}
setTimeout("preventBack()",0);
window.onunload =function(){null};
</script>
</script> -->
{%endblock%}
{%block body%}
......@@ -197,11 +197,13 @@ profile
</h2>
<center><i class="fa fa-cloud-upload fa-4x"></i></center>
<div class="share-links">
<a href="/arfa/studentTestHome">
<center><button type="button" class="btn btn-lg btn-labeled btn-success" href="#" style="margin-bottom: 15px;">
<span class="btn-label"><i class="fa fa-bell-o"></i></span>A FINISHED PROJECT
<span class="btn-label"><i class="fa fa-bell-o"></i></span>Take Test
</button></center>
</a>
<center><button type="button" class="btn btn-lg btn-labeled btn-warning" href="#">
<span class="btn-label"><i class="fa fa-bell-o"></i></span>A WORK IN PROGRESS
<span class="btn-label"><i class="fa fa-bell-o"></i></span>Resume Test
</button></center>
</div>
</div>
......
{%extends 'base2.html'%}
{%block head%}
{%endblock%}
{%block title%}
My Tests
{%endblock%}
{%block body%}
<h1>Currently Active Tests </h1>
<div class="container">
<div class="panel-default">
<div class="panel-heading">
<h3 class="panel-title">Active Tests</h3>
</div>
<ul class="list-group">
{% for t in activeTests %}
<div>
<p>{{t.test_ID}}</p>
<p>{{t.test_name}}</p>
</div>
<div style="float:right">
<form method="POST" action="loadStudentTest">
<input name="testID" value="{{t.test_ID}}" type="hidden">
<button>Load Test</button>
</form>
</div>
{% endfor %}
</ul>
</div>
</div>
</div>
{% if practiceTests %}
<div class="container">
<div class="panel-default">
<div class="panel-heading">
<h3 class="panel-title">Practice Tests</h3>
</div>
<ul class="list-group">
{% for t in practiceTests %}
<div>
<p>{{t.test_ID}}</p>
<p>{{t.test_name}}</p>
</div>
<div style="float:right">
<form method="POST" action="loadStudentTest">
<input name="testID" value="{{t.test_ID}}" type="hidden">
<button>Load Test</button>
</form>
</div>
{% endfor %}
</ul>
</div>
</div>
</div>
{% endif %}
{%endblock%}
\ No newline at end of file
{%extends 'base2.html'%}
{%block head%}
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/MathJax.js?config=TeX-MML-AM_CHTML">
MathJax.Hub.Config({tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]}});
</script>
{%endblock%}
{%block title%}
View personal Question
{%endblock%}
{%block body%}
<h1> You CAN VIEW all your tests HERE student {{username}}</h1>
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.min.css">
<div class="container">
<div class="panel-default">
<div class="panel-heading">
<h3 class="panel-title">LIST OF QUESTIONS</h3>
</div>
<ul class="list-group">
<!-- <ul> -->
{%for question in questions%}
<li class="list-group-item">
<!-- <li> -->
<div class="row toggle">
<div class="col-xs-10">
{{question.question_text}}
</div>
</div>
<div>
<hr></hr>
<!-- <div class="container"> -->
<!-- <div class="fluid-row"> -->
<ul>
{%for option in question.option_details%}
<!-- <div class="col-xs-1"> -->
<li> {{option.is_answer}}
<!-- </div> -->
<!-- <div class="col-xs-5"> -->
{{option.option_text}}
<!-- </div> -->
</li>
{%endfor%}
</ul>
<!-- </div> -->
<!-- </div> -->
</div>
</li>
{%endfor%}
</ul>
</div>
</div>
{%endblock%}
\ No newline at end of file
{%extends 'base2.html'%}
{%block head%}
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/MathJax.js?config=TeX-MML-AM_CHTML">
{%load static%}
<script src="{% static 'ARFA_app/lib/mathjax/MathJax.js' %}">
MathJax.Hub.Config({tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]}});
</script>
{%endblock%}
......
......@@ -3,9 +3,13 @@
<html>
<head>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
{% load static %}
<link rel="stylesheet" href="{% static 'ARFA_app/lib/bootstrap-3.3.7-dist/css/bootstrap.min.css' %}" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<!-- <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"> -->
<script src="{% static 'ARFA_app/lib/jquery/jquery-3.3.1.min.js' %}"></script>
<!-- <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> -->
<script src="{% static 'ARFA_app/lib/bootstrap-3.3.7-dist/js/bootstrap.min.js' %}"></script>
<!-- <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link href="https://fonts.googleapis.com/css?family=Architects+Daughter|Bellefair|Inconsolata|Indie+Flower|Lemonada|Lobster|Noto+Sans|Oswald|Plaster" rel="stylesheet">
<title>
......
......@@ -18,11 +18,13 @@ urlpatterns=[
url(r'^success_mantra',views.success_mantra),
url(r'^timetable',views.timetable),
url(r'^students',views.students),
url(r'^view_my_test',views.students),
url(r'^faculty',views.faculty),
url(r'^ContactUs',views.ContactUs),
url(r'^send_mess',views.send_mess),
url(r'^add_question',views.add_question),
url(r'^register',views.register),
url(r'^reg',views.reg),
url(r'^reg',views.reg),
url(r'^studentTestHome', views.studentTestHome)
]
......@@ -19,13 +19,14 @@ from django.views.decorators.cache import cache_control
import json
from django.db import connection
from django.db import IntegrityError
from django.db.models import F
from .forms import TestForm
import datetime
def login(request):
print("session currently is "+str(request.session.get('session',None)))
if(request.session.get('session',None)==True):
print(request.session['session'])
return redirect('/arfa/profile')
return render(request,'ARFA_app/login.html')
......@@ -44,31 +45,16 @@ def reg(request):
if(request.method=="POST"):
role=request.POST['role']
data={'username': request.POST['username'], 'name':request.POST['name'],'email_ID': request.POST['email_ID'],'address':request.POST['email_ID'],'password':request.POST['password'],'phone_number':request.POST['phone_number']}
# data = dict(request.POST.copy()) #copy to make QueryDict mutable. HttpResponse is immutable
# data.pop('csrfmiddlewaretoken')
# data.pop('role')
# data.pop('repassword')
# data['phone_number']=str(data['phone_number'])
# data.pop('phone_number')
# data={'name':request.POST['name']}
# print(data)
# data = list(map(lambda x: x, data))
# print(data)
if(role=="Student"):
s=models.Student(**data)
s.save()
# print "me"
else:
data['salary']=0
# print (request.POST['subject_ID'])
data['subject_ID']=models.Subject.objects.filter(subject_ID=request.POST['subject_ID']).get()
s=models.Faculty(**data)
# print(s)
s.save()
# args={'phone_number':requestphone_number}
# print (request.POST)
return redirect('/arfa/register')
else:
return redirect('/arfa')
......@@ -76,7 +62,6 @@ def reg(request):
def students(request):
students=models.Student.objects.all().values()
print students
args={'students':students}
args2=request.session.get('args',None)
if args2!=None:
......@@ -85,7 +70,6 @@ def students(request):
def faculty(request):
faculty=models.Faculty.objects.all().values()
print faculty
args={'facultys':faculty}
args2=request.session.get('args',None)
if args2!=None:
......@@ -104,6 +88,7 @@ def send_mess(request):
args={'name':name,'phone_number':phone_number,'email_ID':email_ID,'text':message}
Info=models.ContactUs(**args)
Info.save()
args.update(request.session.get('args',None))
return render(request,'ARFA_app/Success.html',args)
else:
return redirect('/arfa/ContactUs')
......@@ -122,7 +107,6 @@ def profile(request):
if(not(authenticated["status"])):
return redirect('/arfa/',authenticated)
else:
# return redirect(request,'ARFA_app/home.html',args)
request.session['username'] = args['user']
request.session['session'] = True
request.session.get('role',None)
......@@ -160,14 +144,42 @@ def check_auth(args):
def logout(request):
request.session['session']=False
# print(request.session.get('username',None))
request.session.flush()
return render(request,'ARFA_app/logout.html')
def testHome(request):
# if request.method == 'GET':
def studentTestHome(request):
if(request.session.get('session',None)!=True):
return render(request,'ARFA_app/login.html')
if(request.session.get('role',None)!="student"):
return HttpResponse("Not a student")
now = datetime.datetime.now()
activeTests = Test.objects.filter(start_time__gte = now - F('expected_time_for_completion'),
start_time__lte = now)
practiceTests = Test.objects.filter(start_time__lte = now - F('expected_time_for_completion'))
data = {}
data['username'] = request.session['username']
data['is_session'] = True
data['activeTests'] = []
for t in activeTests:
data['activeTests'].append({'test_ID':t.test_ID, 'test_name':t.test_name,
'marks':t.max_marks, 'start_time':t.start_time})
data['practiceTests'] = []
for t in practiceTests:
data['practiceTests'].append({'test_ID':t.test_ID, 'test_name':t.test_name,
'marks':t.max_marks, 'start_time':t.start_time})
print data
return render(request, 'ARFA_app/studentTestHome.html', data)
def loadStudentTest(request):
if request.method == 'POST':
test_ID = request.POST['test_ID']
def testHome(request):
# if request.method == 'GET':
allOptions = models.Options.objects.select_related('q_ID').all()
json = {'testID':'3'}
......@@ -181,25 +193,14 @@ def testHome(request):
# return HttpResponse(json)
json['questions'] = questionsJSON
print json
return render(request, 'ARFA_app/home.html', {'data':json})
def result(request):
if request.method == 'POST':
print request.POST
print request.session
data = dict(request.POST.copy()) #copy to make QueryDict mutable. HttpResponse is immutable
data.pop('csrfmiddlewaretoken')
print data
responseObj = Responses()
# responseData = {'Student_ID':request.session['username']}
# responseData['test_ID'] = data.pop('testID')
print request.session['username']
responseObj.student_ID = Student.objects.get(username=request.session['username'])
# print responseObj.student_ID
# print data['testID']
# print data.pop('testID')[0]
try:
responseObj.test_ID = Test.objects.get(test_ID=int(data.pop('testID')[0]))
except Test.DoesNotExist as e:
......@@ -256,7 +257,6 @@ def view_personal_question(request):
WHERE q.faculty_id = %s and s."subject_ID" = q."subject_ID_id" and q."q_ID" = o."q_ID_id"
order by s.subject,q_ID ''',[args['username']])
rows = cursor.fetchall()
# print(len(rows))
columns = [col[0] for col in cursor.description]
res=[]
options_so_far = []
......@@ -311,41 +311,59 @@ def create_Test(request):
res = utilities.get_all_questions(request)
test = None
<<<<<<< HEAD
TestForm = forms.TestForm()
args={'username':request.session['username'],'questions':res, 'TestForm':TestForm}
args.update(request.session.get('args',None))
=======
form = forms.TestForm()
args={'username':request.session['username'],'questions':res, 'TestForm':TestForm,
'is_session':True}
>>>>>>> 8d3997dd058602c30fc1a3457cea76834f0106cc
if request.method == "GET":
print res
return render(request,'ARFA_app/create_Test.html',args)
if request.method == "POST":
form = TestForm(request.POST)
data = dict(request.POST.copy()) #copy to make QueryDict mutable. HttpResponse is immutable
data.pop('csrfmiddlewaretoken')
if not data: #only csrf token was sent, display create test page
return render(request,'ARFA_app/create_Test.html',args)
if TestForm.is_valid():
test = TestForm.save()
if form.is_valid():
test = form.save()
else:
print form
if form.errors:
for field in form :
print field.errors
return HttpResponse("Test Form Invalid")
# for attr in dir(Test):
# print attr
# try:
# data.pop(attr)
# except KeyError as e:
# pass
for attr in dir(Test):
print attr
try:
data.pop(attr)
except KeyError as e:
pass
#data is being sent
#create test object
# test = Test()
containsObj = models.Contains(test_ID=test)
print data
for q in data.keys():
if len(data[q]) != 3:
continue
try:
if q[0] != 'i':
continue ;
int(q)
containsObj.q_ID_id = q
print q
#data[q] is an array ['True', 'pos_marks', 'neg_marks']
containsObj.marks_pos = data[q][1]
containsObj.marks_neg = data[q][2]
containsObj.marks_pos = data[q + "1"]
containsObj.marks_neg = data[q + "2"]
containsObj.pk = None
containsObj.save()
except ValueError as e:
......@@ -354,7 +372,7 @@ def create_Test(request):
# for q in data:
print data
return view_personal_Test(request)
def view_all_Test(request):
......
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