diff options
author | adityacp | 2017-06-13 16:29:12 +0530 |
---|---|---|
committer | adityacp | 2017-06-13 16:29:12 +0530 |
commit | 18fff6daed3d57471514fdf189c60865838d43ee (patch) | |
tree | c8cb2fa842d5540989cd11a6c56a13bff38813d0 /yaksh/views.py | |
parent | 3552f4bc8082fc3ecc5290029cac6a839cd3b247 (diff) | |
parent | ebc8a2af6d4fdf52a9703701a97a3abfaf66ed06 (diff) | |
download | online_test-18fff6daed3d57471514fdf189c60865838d43ee.tar.gz online_test-18fff6daed3d57471514fdf189c60865838d43ee.tar.bz2 online_test-18fff6daed3d57471514fdf189c60865838d43ee.zip |
Resolve conflicts with latest changes
Diffstat (limited to 'yaksh/views.py')
-rw-r--r-- | yaksh/views.py | 36 |
1 files changed, 5 insertions, 31 deletions
diff --git a/yaksh/views.py b/yaksh/views.py index 9785230..ffdcf98 100644 --- a/yaksh/views.py +++ b/yaksh/views.py @@ -281,31 +281,6 @@ def add_quiz(request, course_id, quiz_id=None): context, context_instance=ci) - -@login_required -@email_verified -def show_all_questionpapers(request, questionpaper_id=None): - user = request.user - ci = RequestContext(request) - if not user.is_authenticated() or not is_moderator(user): - raise Http404('You are not allowed to view this page!') - - if questionpaper_id is None: - qu_papers = QuestionPaper.objects.filter(is_trial=False) - context = {'papers': qu_papers} - return my_render_to_response('yaksh/showquestionpapers.html', context, - context_instance=ci) - else: - qu_papers = QuestionPaper.objects.get(id=questionpaper_id) - quiz = qu_papers.quiz - fixed_questions = qu_papers.get_ordered_questions() - random_questions = qu_papers.random_questions.all() - context = {'quiz': quiz, 'fixed_questions': fixed_questions, - 'random_questions': random_questions} - return my_render_to_response('yaksh/editquestionpaper.html', context, - context_instance=ci) - - @login_required @email_verified def prof_manage(request, msg=None): @@ -929,7 +904,6 @@ def ajax_questions_filter(request): if language != "select": filter_dict['language'] = str(language) - questions = list(Question.objects.filter(**filter_dict)) return my_render_to_response('yaksh/ajax_question_filter.html', @@ -1089,8 +1063,8 @@ def show_all_questions(request): question = Question() zip_file = question.dump_questions(question_ids, user) response = HttpResponse(content_type='application/zip') - response['Content-Disposition'] = '''attachment;\ - filename={0}_questions.zip'''.format(user) + response['Content-Disposition'] = dedent(\ + '''attachment; filename={0}_questions.zip'''.format(user)) zip_file.seek(0) response.write(zip_file.read()) return response @@ -1132,7 +1106,6 @@ def user_data(request, user_id, questionpaper_id=None): return my_render_to_response('yaksh/user_data.html', context, context_instance=RequestContext(request)) - @login_required @email_verified def download_csv(request, questionpaper_id): @@ -1612,6 +1585,8 @@ def update_email(request): @email_verified def download_assignment_file(request, quiz_id, question_id=None, user_id=None): user = request.user + if not is_moderator(user): + raise Http404("You are not allowed to view this page") qp = QuestionPaper.objects.get(quiz_id=quiz_id) assignment_files, file_name = AssignmentUpload.objects.get_assignments(qp, question_id, @@ -1630,8 +1605,7 @@ def download_assignment_file(request, quiz_id, question_id=None, user_id=None): zip_file.close() zipfile_name.seek(0) response = HttpResponse(content_type='application/zip') - response['Content-Disposition'] = '''attachment;\ - filename={0}.zip'''.format( + response['Content-Disposition'] = 'attachment; filename={0}.zip'.format( file_name.replace(" ", "_") ) response.write(zipfile_name.read()) |