Files
kursy-mirror/home/models.py

34 lines
818 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

from wagtail.models import Page
from wagtail.fields import RichTextField
class HomePage(Page):
body = RichTextField(blank=True)
content_panels = Page.content_panels + ["body"]
class CoursePage(Page):
body = RichTextField(blank=True)
content_panels = Page.content_panels + ["body"]
class CourseModulePage(Page):
body = RichTextField(blank=True)
@property
def full_title(self):
if hasattr(self, "get_parent"):
parent = self.get_parent()
if parent and hasattr(parent, "specific"):
course = parent.specific
else:
course = None
if course and hasattr(course, "title"):
return f"{course.title} {self.title}"
return self.title
content_panels = Page.content_panels + ["body"]