summaryrefslogtreecommitdiff
path: root/testapp/exam
diff options
context:
space:
mode:
authorhardythe12012-03-28 11:55:34 +0530
committerhardythe12012-03-28 11:55:34 +0530
commit64b38d3365f1d65132942fce6e29fed7da076bba (patch)
tree15c07993620743f097cbf739e90fc3da59b957b1 /testapp/exam
parent246478f4ef75ae713e96a64d210bd3710bed3df9 (diff)
downloadonline_test-64b38d3365f1d65132942fce6e29fed7da076bba.tar.gz
online_test-64b38d3365f1d65132942fce6e29fed7da076bba.tar.bz2
online_test-64b38d3365f1d65132942fce6e29fed7da076bba.zip
minor changes
Diffstat (limited to 'testapp/exam')
-rw-r--r--testapp/exam/urls.py4
-rw-r--r--testapp/exam/views.py21
2 files changed, 7 insertions, 18 deletions
diff --git a/testapp/exam/urls.py b/testapp/exam/urls.py
index 1e1cd12..f435e63 100644
--- a/testapp/exam/urls.py
+++ b/testapp/exam/urls.py
@@ -3,9 +3,9 @@ from django.conf.urls.defaults import patterns, include, url
urlpatterns = patterns('exam.views',
url(r'^$', 'index'),
url(r'^login/$', 'user_login'),
- url(r'^quizlist/$', 'quizlist'),
- url(r'^start/(?P<quiz_id>\d+)/$', 'start'),
+ url(r'^start/$', 'start'),
url(r'^quit/$', 'quit'),
+ url(r'^intro/$','start'),
url(r'^complete/$', 'complete'),
url(r'^register/$', 'user_register'),
url(r'^(?P<q_id>\d+)/$', 'question'),
diff --git a/testapp/exam/views.py b/testapp/exam/views.py
index dedf68c..5b980f5 100644
--- a/testapp/exam/views.py
+++ b/testapp/exam/views.py
@@ -69,7 +69,7 @@ def user_register(request):
user = request.user
if user.is_authenticated():
- return my_redirect("/exam/quizlist/")
+ return my_redirect("/exam/start/")
if request.method == "POST":
form = UserRegisterForm(request.POST)
@@ -79,7 +79,7 @@ def user_register(request):
new_user = authenticate(username = u_name, password = pwd)
login(request, new_user)
- return my_redirect("/exam/quizlist/")
+ return my_redirect("/exam/start/")
else:
return my_render_to_response('exam/register.html',
@@ -307,7 +307,7 @@ def user_login(request):
if user.is_authenticated():
if user.groups.filter(name='moderator').count() > 0 :
return my_redirect('/exam/manage/')
- return my_redirect("/exam/quizlist/")
+ return my_redirect("/exam/intro/")
if request.method == "POST":
form = UserLoginForm(request.POST)
@@ -327,14 +327,14 @@ def user_login(request):
return my_render_to_response('exam/login.html', context,
context_instance=RequestContext(request))
-def start(request,quiz_id=None):
+def start(request):
"""Check the user cedentials and if any quiz is available, start the exam."""
user = request.user
try:
# Right now the app is designed so there is only one active quiz
# at a particular time.
- quiz = Quiz.objects.get(id=quiz_id)
+ quiz = Quiz.objects.get(active=True)
except Quiz.DoesNotExist:
msg = 'Quiz not found, please contact your '\
'instructor/administrator. Please login again thereafter.'
@@ -548,17 +548,6 @@ def show_all_users(request):
context = { 'question': questionpaper }
return my_render_to_response('exam/showusers.html',context,context_instance=RequestContext(request))
-def quizlist(request):
- """Generates a list of all the quizzes that are active for the students to attempt."""
-
- quizzes = Quiz.objects.all()
- context = {'papers': [],
- 'quiz': None,
- 'quizzes':quizzes}
- return my_render_to_response('exam/quizlist.html', context,
- context_instance=RequestContext(request))
-
-
def show_all_quiz(request):
"""Generates a list of all the quizzes that are currently in the database."""