summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormaheshgudi2016-09-06 16:14:08 +0530
committermaheshgudi2016-09-06 16:14:08 +0530
commit27720bb67d5c44dcb2d9ec8f315f4e26624c0a4c (patch)
treedfb184502e1d6a0b072f5c022c068a13c3834484
parent01e08dd15b59ce353043d541c9be81592cda3fe0 (diff)
downloadonline_test-27720bb67d5c44dcb2d9ec8f315f4e26624c0a4c.tar.gz
online_test-27720bb67d5c44dcb2d9ec8f315f4e26624c0a4c.tar.bz2
online_test-27720bb67d5c44dcb2d9ec8f315f4e26624c0a4c.zip
users and not course creator will see their own trial papers
-rw-r--r--yaksh/templates/manage.html8
-rw-r--r--yaksh/views.py6
2 files changed, 8 insertions, 6 deletions
diff --git a/yaksh/templates/manage.html b/yaksh/templates/manage.html
index 2fd0f7a..2baf492 100644
--- a/yaksh/templates/manage.html
+++ b/yaksh/templates/manage.html
@@ -78,15 +78,15 @@
<h5>Click on the button given below to add a new course.</h5>
<button class="btn" type="button" onClick='location.replace("{{URL_ROOT}}/exam/manage/add_course");'>Add New Course</button>
</center>
- {% if trial_quiz %}
+ {% if trial_paper %}
<h5/> You have trial papers.
<table class="bordered-table zebra-striped">
<form action="" method="post">
{% csrf_token %}
- {% for quiz in trial_quiz %}
+ {% for paper in trial_paper %}
<tr>
- <td> <input type = "checkbox" name="delete_quiz" value = {{quiz.id}}></input></td>
- <td> <a href="{{URL_ROOT}}/exam/manage/gradeuser/{{quiz.id}}">{{quiz.description}}</td>
+ <td> <input type = "checkbox" name="delete_quiz" value = {{paper.question_paper.quiz.id}}></input></td>
+ <td> <a href="{{URL_ROOT}}/exam/manage/gradeuser/{{paper.question_paper.quiz.id}}">{{paper.question_paper.quiz.description}}</td>
</tr>
{% endfor %}
</table>
diff --git a/yaksh/views.py b/yaksh/views.py
index 1abf248..476ccc6 100644
--- a/yaksh/views.py
+++ b/yaksh/views.py
@@ -313,7 +313,9 @@ rights/permissions and log in."""
question_papers = QuestionPaper.objects.filter(quiz__course__creator=user,
quiz__is_trial=False
)
- trial_quiz = Quiz.objects.filter(course__creator=user, is_trial=True)
+ trial_paper = AnswerPaper.objects.filter(user=user,
+ question_paper__quiz__is_trial=True
+ )
if request.method == "POST":
delete_quiz = request.POST.getlist('delete_quiz')
for quiz_id in delete_quiz:
@@ -332,7 +334,7 @@ rights/permissions and log in."""
temp = paper, answer_papers, users_passed, users_failed
users_per_paper.append(temp)
context = {'user': user, 'users_per_paper': users_per_paper,
- 'trial_quiz': trial_quiz
+ 'trial_paper': trial_paper
}
return my_render_to_response('manage.html', context, context_instance=ci)
return my_redirect('/exam/login/')