feat(home/models.py): add CourseModulePage.course property

This commit is contained in:
2026-03-12 14:08:48 +01:00
parent bddc857345
commit da0c06d3b6

View File

@@ -41,16 +41,18 @@ class CourseModulePage(Page):
body = RichTextField(blank=True)
@property
def full_title(self):
def course(self):
if hasattr(self, "get_parent"):
parent = self.get_parent()
if parent and hasattr(parent, "specific"):
course = parent.specific
else:
course = None
return parent.specific
return None
if course and hasattr(course, "title"):
return f"{course.title} {self.title}"
@property
def full_title(self):
course = self.course
if course:
return f"{course.title} - {self.title}"
return self.title
content_panels = Page.content_panels + ["body"]