diff options
author | prathamesh | 2016-03-07 16:29:47 +0530 |
---|---|---|
committer | prathamesh | 2016-03-07 16:29:47 +0530 |
commit | e94f589eea5fbe85253d35f836d308bbfd339ff0 (patch) | |
tree | fed6bee014f126eb5c435e2ed53235a2ba9e224d /yaksh/views.py | |
parent | b58a0b9831d8e6434362f776c89076c2d84e9b26 (diff) | |
download | online_test-e94f589eea5fbe85253d35f836d308bbfd339ff0.tar.gz online_test-e94f589eea5fbe85253d35f836d308bbfd339ff0.tar.bz2 online_test-e94f589eea5fbe85253d35f836d308bbfd339ff0.zip |
Added a checkpoint, quizzes will be available only if the user is
enrolled for the respective course.
Diffstat (limited to 'yaksh/views.py')
-rw-r--r-- | yaksh/views.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/yaksh/views.py b/yaksh/views.py index ffe8d93..20a416d 100644 --- a/yaksh/views.py +++ b/yaksh/views.py @@ -184,6 +184,8 @@ def intro(request, questionpaper_id): user = request.user ci = RequestContext(request) quest_paper = QuestionPaper.objects.get(id=questionpaper_id) + if not quest_paper.quiz.course.is_enrolled(user): + raise Http404('You are not allowed to view this page!') attempt_number = quest_paper.quiz.attempts_allowed time_lag = quest_paper.quiz.time_between_attempts quiz_enable_time = quest_paper.quiz.start_date_time @@ -822,6 +824,9 @@ def start(request, attempt_num=None, questionpaper_id=None): 'instructor/administrator. Please login again thereafter.' return complete(request, msg, attempt_num, questionpaper_id) + if not questionpaper.quiz.course.is_enrolled(user): + raise Http404('You are not allowed to view this page!') + try: old_paper = AnswerPaper.objects.get( question_paper=questionpaper, user=user, attempt_number=attempt_num) |