summaryrefslogtreecommitdiff
path: root/yaksh
diff options
context:
space:
mode:
authoradityacp2018-07-20 12:36:05 +0530
committeradityacp2018-07-20 12:36:05 +0530
commitf4b6bf5349c3916321a5ed3d67159548b4bb56ce (patch)
treeb919b9217002296ce1d059ba0173038a69f6d486 /yaksh
parent477ff979058b6f64dd6af05122914a900e9e6810 (diff)
downloadonline_test-f4b6bf5349c3916321a5ed3d67159548b4bb56ce.tar.gz
online_test-f4b6bf5349c3916321a5ed3d67159548b4bb56ce.tar.bz2
online_test-f4b6bf5349c3916321a5ed3d67159548b4bb56ce.zip
Raise 404 error if course and question paper are not available
Diffstat (limited to 'yaksh')
-rw-r--r--yaksh/views.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/yaksh/views.py b/yaksh/views.py
index 444b324..8ccc12b 100644
--- a/yaksh/views.py
+++ b/yaksh/views.py
@@ -2101,13 +2101,13 @@ def update_email(request):
def download_assignment_file(request, quiz_id, course_id,
question_id=None, user_id=None):
user = request.user
- course = Course.objects.get(id=course_id)
+ course = get_object_or_404(Course, pk=course_id)
if (not course.is_creator(user) and not course.is_teacher(user) and
not course.is_student(user)):
raise Http404("You are not allowed to download files for {0}".format(
course.name)
)
- qp = QuestionPaper.objects.get(quiz_id=quiz_id)
+ qp = get_object_or_404(QuestionPaper, quiz_id=quiz_id)
assignment_files, file_name = AssignmentUpload.objects.get_assignments(
qp, question_id, user_id, course_id
)