diff options
author | CruiseDevice | 2021-03-15 13:40:12 +0530 |
---|---|---|
committer | CruiseDevice | 2021-03-15 13:40:12 +0530 |
commit | b457c973b491d373ed9c5087b61bf29ce128d766 (patch) | |
tree | 19d4fc4441dd4030366c44d26a75f73abee549f9 /yaksh | |
parent | ccc578beff8363ea19826d6c621dafabe210531f (diff) | |
download | online_test-b457c973b491d373ed9c5087b61bf29ce128d766.tar.gz online_test-b457c973b491d373ed9c5087b61bf29ce128d766.tar.bz2 online_test-b457c973b491d373ed9c5087b61bf29ce128d766.zip |
Replacing .id with _id in get_assignment_dir()
- .id fetches entire model which is unnecessary. _id only fetches
the primary key.
Diffstat (limited to 'yaksh')
-rw-r--r-- | yaksh/models.py | 10 |
1 files changed, 5 insertions, 5 deletions
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 )) |