From 085b1fae43a16cff87e1ab0cf3730e84d4943442 Mon Sep 17 00:00:00 2001 From: CruiseDevice Date: Wed, 3 Mar 2021 23:55:24 +0530 Subject: Fix failing test --- yaksh/models.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'yaksh/models.py') diff --git a/yaksh/models.py b/yaksh/models.py index ca0f2d8..30c69c3 100644 --- a/yaksh/models.py +++ b/yaksh/models.py @@ -121,15 +121,16 @@ MOD_GROUP_NAME = 'moderator' def get_assignment_dir(instance, filename): - folder = str(instance.answer_paper.course_id) - sub_folder = str(instance.answer_paper.question_paper.quiz_id) + course = instance.answer_paper.course + quiz = instance.answer_paper.question_paper.quiz + folder = f'{course.name.replace(" ", "_")}_{course.id}' + sub_folder = f'{quiz.description.replace(" ","_")}_{quiz.id}' user = instance.answer_paper.user.username return os.sep.join((folder, sub_folder, user, str(instance.assignmentQuestion.id), filename )) - def get_model_class(model): ctype = ContentType.objects.get(app_label="yaksh", model=model) model_class = ctype.model_class() -- cgit