From b457c973b491d373ed9c5087b61bf29ce128d766 Mon Sep 17 00:00:00 2001 From: CruiseDevice Date: Mon, 15 Mar 2021 13:40:12 +0530 Subject: Replacing .id with _id in get_assignment_dir() - .id fetches entire model which is unnecessary. _id only fetches the primary key. --- yaksh/models.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'yaksh/models.py') diff --git a/yaksh/models.py b/yaksh/models.py index e88a9e4..4661ea7 100644 --- a/yaksh/models.py +++ b/yaksh/models.py @@ -121,13 +121,13 @@ MOD_GROUP_NAME = 'moderator' def get_assignment_dir(instance, filename): - course = instance.answer_paper.course - quiz = instance.answer_paper.question_paper.quiz - folder = f'Course_{course.id}' - sub_folder = f'Quiz_{quiz.id}' + course_id = instance.answer_paper.course_id + quiz_id = instance.answer_paper.question_paper.quiz_id + folder = f'Course_{course_id}' + sub_folder = f'Quiz_{quiz_id}' user = instance.answer_paper.user.username return os.sep.join((folder, sub_folder, user, - str(instance.assignmentQuestion.id), + str(instance.assignmentQuestion_id), filename )) -- cgit