diff options
Diffstat (limited to 'yaksh/models.py')
-rw-r--r-- | yaksh/models.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/yaksh/models.py b/yaksh/models.py index d65970b..6ad5eec 100644 --- a/yaksh/models.py +++ b/yaksh/models.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals from datetime import datetime, timedelta import json from random import sample, shuffle @@ -351,7 +352,7 @@ class Question(models.Model): for file_name, extract in file_names: q_file = os.path.join(path, file_name) if os.path.exists(q_file): - que_file = open(q_file, 'r') + que_file = open(q_file, 'rb') # Converting to Python file object with # some Django-specific additions django_file = File(que_file) @@ -378,8 +379,7 @@ class Question(models.Model): self.load_questions(questions_list, user, file_path, files) def create_demo_questions(self, user): - zip_file_path = os.path.join(os.getcwd(), 'yaksh', - 'fixtures', 'demo_questions.zip') + zip_file_path = os.path.join(settings.FIXTURE_DIRS, 'demo_questions.zip') files, extract_path = extract_files(zip_file_path) self.read_json(extract_path, user, files) |