summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhardythe12012-02-15 18:35:40 +0530
committerhardythe12012-02-15 18:35:40 +0530
commit7c65d02d8a1f2ea72eabf3f13f85b8b444b1505e (patch)
tree8b5cbdef2a1be1193600b3e6a3c4e9a47024d33b
parent85a76d4777d3917cf5dbb716107581d4998c408d (diff)
downloadonline_test-7c65d02d8a1f2ea72eabf3f13f85b8b444b1505e.tar.gz
online_test-7c65d02d8a1f2ea72eabf3f13f85b8b444b1505e.tar.bz2
online_test-7c65d02d8a1f2ea72eabf3f13f85b8b444b1505e.zip
New views to manage/moderate Quiz
-rw-r--r--testapp/exam/urls.py4
-rw-r--r--testapp/exam/views.py17
-rw-r--r--testapp/static/exam/css/base.css4
-rw-r--r--testapp/templates/exam/grade_user.html24
-rw-r--r--testapp/templates/exam/monitor.html29
5 files changed, 30 insertions, 48 deletions
diff --git a/testapp/exam/urls.py b/testapp/exam/urls.py
index 34e329f..4545897 100644
--- a/testapp/exam/urls.py
+++ b/testapp/exam/urls.py
@@ -3,6 +3,10 @@ from django.conf.urls.defaults import patterns, include, url
urlpatterns = patterns('exam.views',
url(r'^$', 'index'),
url(r'^login/$', 'user_login'),
+ url(r'^manage/$', 'prof_manage'),
+ url(r'^addquestion/$', 'add_question'),
+ url(r'^addquiz/$', 'add_quiz'),
+ url(r'^grade_user/$', 'show_all_users'),
url(r'^register/$', 'user_register'),
url(r'^start/$', 'start'),
url(r'^quit/$', 'quit'),
diff --git a/testapp/exam/views.py b/testapp/exam/views.py
index 05b69d1..aed45d5 100644
--- a/testapp/exam/views.py
+++ b/testapp/exam/views.py
@@ -90,6 +90,15 @@ def user_register(request):
{'form':form},
context_instance=RequestContext(request))
+def add_question(request):
+ return render_to_response('exam/add_question.html',{})
+
+def add_quiz(request):
+ return render_to_response('exam/add_quiz.html',{})
+
+def prof_manage(request):
+ return render_to_response('manage.html',{})
+
def user_login(request):
"""Take the credentials of the user and log the user in."""
@@ -309,6 +318,12 @@ def get_user_data(username):
data['papers'] = papers
return data
+def show_all_users(request):
+ user = User.objects.filter(username__contains="")
+ context = { 'user':user }
+ print context
+ return my_render_to_response('exam/showusers.html',context,context_instance=RequestContext(request))
+
def user_data(request, username):
"""Render user data."""
current_user = request.user
@@ -342,10 +357,12 @@ def grade_user(request, username):
paper.save()
context = {'data': data}
+ print context
return my_render_to_response('exam/user_data.html', context,
context_instance=RequestContext(request))
else:
context = {'data': data}
+ print context
return my_render_to_response('exam/grade_user.html', context,
context_instance=RequestContext(request))
diff --git a/testapp/static/exam/css/base.css b/testapp/static/exam/css/base.css
index ef5b374..6891402 100644
--- a/testapp/static/exam/css/base.css
+++ b/testapp/static/exam/css/base.css
@@ -207,7 +207,7 @@ body {
}
.container-fluid > .sidebar {
position: absolute;
- top: 0;
+ top: 65px;
left: 20px;
width: 220px;
}
@@ -2132,7 +2132,7 @@ button.btn::-moz-focus-inner, input[type=submit].btn::-moz-focus-inner {
background-color: #f5f5f5;
margin-bottom: 20px;
padding: 19px;
- min-height: 20px;
+ min-height: 505px;
border: 1px solid #eee;
border: 1px solid rgba(0, 0, 0, 0.05);
-webkit-border-radius: 4px;
diff --git a/testapp/templates/exam/grade_user.html b/testapp/templates/exam/grade_user.html
index 89faf46..fa0e516 100644
--- a/testapp/templates/exam/grade_user.html
+++ b/testapp/templates/exam/grade_user.html
@@ -1,18 +1,10 @@
-{% extends "base.html" %}
+{% extends "manage.html" %}
{% block title %} Grading papers for {{ data.user.get_full_name.title }} {% endblock title %}
-{% block content %}
-
- <div class="container">
- <div class="content">
-<div class="page-header">
-<h1><Strong><center>Online Test</center></strong></h1>
-</div>
- <div class=row>
- <div class=span14>
-<h3><center>Grading papers for {{ data.user.get_full_name.title }}</center></h3><br>
+{% block subtitle %}Grading papers for {{ data.user.get_full_name.title }}{% endblock %}
+{% block manage %}
<p>
Name: {{ data.user.get_full_name.title }}
@@ -89,13 +81,5 @@ Marks: <input id="q{{ question.id }}" type="text"
{% endif %}
<br />
<a href="{{URL_ROOT}}/admin/">Admin</a>
-</div>
- </div>
- </div>
-<footer>
- <p>&copy; FOSSEE group, IIT Bombay</p>
- </footer>
-
- </div> <!-- /container -->
-{% endblock content %}
+{% endblock%}
diff --git a/testapp/templates/exam/monitor.html b/testapp/templates/exam/monitor.html
index 0b59f76..4847545 100644
--- a/testapp/templates/exam/monitor.html
+++ b/testapp/templates/exam/monitor.html
@@ -1,23 +1,13 @@
-{% extends "base.html" %}
-
-<html lang="en">
+{% extends "manage.html" %}
{% block title %} Quiz results {% endblock title %}
{% block meta %} <meta http-equiv="refresh" content="30"/> {% endblock meta %}
- <body>
-{% block content %}
- <div class="container">
- <div class="content">
-<div class="page-header">
-
+{% block manage %}
{% if not quizzes and not quiz %}
<h1><center> Quiz results </center></h1>
-</div>
- <div class=row>
- <div class=span14>
<center><h5> No quizzes available. </h5></center>
@@ -27,9 +17,6 @@
{# This is rendered when we are just viewing exam/monitor #}
{% if quizzes %}
<center><h1> Available quizzes </h1></center>
-</div>
- <div class=row>
- <div class=span14>
<ul>
{% for quiz in quizzes %}
@@ -42,9 +29,6 @@
{# This is rendered when we are just viewing exam/monitor/quiz_num #}
{% if quiz %}
<center><h1> {{ quiz.description }} results </h1></center>
-</div>
- <div class=row>
- <div class=span14>
{% if papers %}
{# <p> Quiz: {{ quiz_name }}</p> #}
@@ -88,11 +72,4 @@ table tbody th {
{% endif %} {# if papers #}
{% endif %}
<a href="{{URL_ROOT}}/admin/">Admin</a>
-</div></div></div>
-
-
-<footer>
- <p>&copy; FOSSEE group, IIT Bombay</p>
- </footer>
-</div>
-{% endblock content %}
+{% endblock %}