diff options
author | Palaparthy Adityachandra | 2020-03-17 15:06:18 +0530 |
---|---|---|
committer | GitHub | 2020-03-17 15:06:18 +0530 |
commit | 15ce39acb70056bdfb9820efa634d704a963cb84 (patch) | |
tree | b54a2d7493be2ba3e9249ae4412c9c231ffaef6b /yaksh/models.py | |
parent | a5e2fb409beebdc33fdb7c230dd50559509fd4c0 (diff) | |
parent | a2186d263aa8927a47fdb9f3a23ad39841b64b33 (diff) | |
download | online_test-15ce39acb70056bdfb9820efa634d704a963cb84.tar.gz online_test-15ce39acb70056bdfb9820efa634d704a963cb84.tar.bz2 online_test-15ce39acb70056bdfb9820efa634d704a963cb84.zip |
Merge pull request #660 from adityacp/fix_course_progress_download_csv
Add a button to download course progress in a CSV
Diffstat (limited to 'yaksh/models.py')
-rw-r--r-- | yaksh/models.py | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/yaksh/models.py b/yaksh/models.py index e161543..065d9cd 100644 --- a/yaksh/models.py +++ b/yaksh/models.py @@ -598,7 +598,12 @@ class LearningUnit(models.Model): check_prerequisite = models.BooleanField(default=True) def get_lesson_or_quiz(self): - return self.lesson if self.lesson else self.quiz + unit = None + if self.type == 'lesson': + unit = self.lesson + else: + unit = self.quiz + return unit def toggle_check_prerequisite(self): if self.check_prerequisite: @@ -648,6 +653,14 @@ class LearningUnit(models.Model): order=self.order, type="lesson", lesson=new_lesson) return new_unit + def __str__(self): + name = None + if self.type == 'lesson': + name = self.lesson.name + else: + name = self.quiz.description + return name + ############################################################################### class LearningModule(models.Model): |