summaryrefslogtreecommitdiff
path: root/yaksh/views.py
diff options
context:
space:
mode:
authormahesh2017-08-03 02:07:47 +0530
committermahesh2017-08-03 02:34:38 +0530
commitd5332431f7c042e7e16183f76dee70269bbebded (patch)
tree37b2efcaa1610adc42ed5e40ac657444af54fca2 /yaksh/views.py
parent66e8f39bb390b3ec2547d82512349fabf67e3d7c (diff)
downloadonline_test-d5332431f7c042e7e16183f76dee70269bbebded.tar.gz
online_test-d5332431f7c042e7e16183f76dee70269bbebded.tar.bz2
online_test-d5332431f7c042e7e16183f76dee70269bbebded.zip
Modifies UI for questions section
Diffstat (limited to 'yaksh/views.py')
-rw-r--r--yaksh/views.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/yaksh/views.py b/yaksh/views.py
index 7e73a28..68253bc 100644
--- a/yaksh/views.py
+++ b/yaksh/views.py
@@ -1590,3 +1590,20 @@ def duplicate_course(request, course_id):
'instructor/administrator.'
return complete(request, msg, attempt_num=None, questionpaper_id=None)
return my_redirect('/exam/manage/courses/')
+
+@login_required
+@email_verified
+def download_yaml_template(request):
+ user = request.user
+ if not is_moderator(user):
+ raise Http404('You are not allowed to view this page!')
+ template_path = os.path.join(os.path.dirname(__file__), "demo_templates",
+ "yaml_question_template"
+ )
+ with open(template_path, 'r') as f:
+ yaml_str = f.read()
+ response = HttpResponse(yaml_str, content_type='text/yaml')
+ response['Content-Disposition'] = 'attachment; filename="questions_dump.yaml"'
+
+ return response
+