diff options
author | mahesh | 2017-08-25 01:33:08 +0530 |
---|---|---|
committer | mahesh | 2017-08-25 01:43:59 +0530 |
commit | 30b48c30abebf75ed4b51fd034600e0c7d58c95b (patch) | |
tree | 53ad33f61c239271f62ee2054ad79cb76688645d /yaksh/views.py | |
parent | eb90ab2fbc1bf86c1549e391aa6cc461aaea699d (diff) | |
download | online_test-30b48c30abebf75ed4b51fd034600e0c7d58c95b.tar.gz online_test-30b48c30abebf75ed4b51fd034600e0c7d58c95b.tar.bz2 online_test-30b48c30abebf75ed4b51fd034600e0c7d58c95b.zip |
Fixes order in demo_questions.zip
- Template yaml is now generated on the fly.
- Removes yaml_question_template files.
- Fixes order for yaml file inside demo_questions.zip
Diffstat (limited to 'yaksh/views.py')
-rw-r--r-- | yaksh/views.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/yaksh/views.py b/yaksh/views.py index 81d180b..3c7df4d 100644 --- a/yaksh/views.py +++ b/yaksh/views.py @@ -1622,13 +1622,14 @@ 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" + template_path = os.path.join(os.path.dirname(__file__), "fixtures", + "demo_questions.zip" ) - 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"' + yaml_file = zipfile.ZipFile(template_path, 'r') + template_yaml = yaml_file.open('questions_dump.yaml', 'r') + response = HttpResponse(template_yaml, content_type='text/yaml') + response['Content-Disposition'] = 'attachment;\ + filename="questions_dump.yaml"' return response |