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