summaryrefslogtreecommitdiff
path: root/yaksh
diff options
context:
space:
mode:
authoradityacp2017-05-19 16:02:43 +0530
committeradityacp2017-05-19 16:02:43 +0530
commite9b89d77ac585c8d95d2fcb5ce12316557f07e4a (patch)
treefa62b0c92103c72b25357fd7de858a21d94529f8 /yaksh
parent86beeae3ef9a18bf5744d438e3f57e51fb4cf34d (diff)
downloadonline_test-e9b89d77ac585c8d95d2fcb5ce12316557f07e4a.tar.gz
online_test-e9b89d77ac585c8d95d2fcb5ce12316557f07e4a.tar.bz2
online_test-e9b89d77ac585c8d95d2fcb5ce12316557f07e4a.zip
Change attachment response in views.py
Diffstat (limited to 'yaksh')
-rw-r--r--yaksh/views.py33
1 files changed, 3 insertions, 30 deletions
diff --git a/yaksh/views.py b/yaksh/views.py
index c7af5cc..eb7a103 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):
@@ -893,7 +868,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',
@@ -1053,8 +1027,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
@@ -1589,8 +1563,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())