fix for non-sectioned lessons nav
[edumed.git] / catalogue / models.py
index e20d58c..652f972 100644 (file)
@@ -202,8 +202,15 @@ class Lesson(models.Model):
             ContentFile(buff.getvalue()))
 
     def get_syntetic(self):
             ContentFile(buff.getvalue()))
 
     def get_syntetic(self):
+        if self.section is None: return None
         return self.section.syntetic_lesson(self.level)
 
         return self.section.syntetic_lesson(self.level)
 
+    def get_other_level(self):
+        if self.section is None: return None
+        other_levels = self.section.lesson_set.exclude(level=self.level)
+        if other_levels.exists():
+            return other_levels[0].level
+
     def get_previous(self):
         if self.section is None: return None
         try:
     def get_previous(self):
         if self.section is None: return None
         try: