feat(home/models.py): add ModuleLessonPage model

This commit is contained in:
2026-03-17 12:34:13 +01:00
parent a44002b714
commit a2a38dbc6d

View File

@@ -79,9 +79,32 @@ class CourseModulePage(Page):
return self.title return self.title
content_panels = Page.content_panels + ["body"] content_panels = Page.content_panels + ["body"]
subpage_types = ["home.ModuleLessonPage"]
parent_page_types = ["home.CoursePage"] parent_page_types = ["home.CoursePage"]
class ModuleLessonPage(Page):
body = RichTextField(blank=True)
@property
def module(self):
if hasattr(self, "get_parent"):
parent = self.get_parent()
if parent and hasattr(parent, "specific"):
return parent.specific
return None
@property
def full_title(self):
module = self.module
if module:
return f"{module.full_title} - {self.title}"
return self.title
content_panels = Page.content_panels + ["body"]
parent_page_types = ["home.CourseModulePage"]
class EventPageTag(TaggedItemBase): class EventPageTag(TaggedItemBase):
content_object = ParentalKey( content_object = ParentalKey(
"home.EventPage", "home.EventPage",