feat(home/models.py): add ModuleLessonPage model
This commit is contained in:
@@ -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",
|
||||||
|
|||||||
Reference in New Issue
Block a user