86 lines
1.9 KiB
Python
86 lines
1.9 KiB
Python
# Create your models here.
|
|
|
|
from django.db import models
|
|
from wagtail.admin.edit_handlers import FieldPanel
|
|
from wagtail.core.fields import RichTextField
|
|
from wagtail.core.models import Page
|
|
|
|
|
|
# class HomePage(Page):
|
|
# body = RichTextField(default='', blank=True)
|
|
#
|
|
# content_panels = Page.content_panels + [
|
|
# FieldPanel('body', classname="full"),
|
|
# ]
|
|
|
|
|
|
class LearningPath(Page):
|
|
content_panels = Page.content_panels + [
|
|
FieldPanel('title', classname="full"),
|
|
]
|
|
|
|
subpage_types = ['learnpath.Topic']
|
|
|
|
class Meta:
|
|
verbose_name = "Learning Path"
|
|
|
|
def __str__(self):
|
|
return f"{self.title}"
|
|
|
|
|
|
class Topic(Page):
|
|
is_visible = models.BooleanField(default=True)
|
|
|
|
content_panels = Page.content_panels + [
|
|
FieldPanel('is_visible', classname="full"),
|
|
]
|
|
|
|
parent_page_types = ['learnpath.LearningPath']
|
|
subpage_types = ['learnpath.Circle']
|
|
|
|
class Meta:
|
|
verbose_name = "Topic"
|
|
|
|
def __str__(self):
|
|
return f"{self.title}"
|
|
|
|
|
|
class Circle(Page):
|
|
description = models.TextField(default="", blank=True)
|
|
goals = models.TextField(default="", blank=True)
|
|
|
|
parent_page_types = ['learnpath.Topic']
|
|
subpage_types = ['learnpath.LearningSequence']
|
|
|
|
content_panels = Page.content_panels + [
|
|
FieldPanel('description'),
|
|
FieldPanel('goals'),
|
|
]
|
|
|
|
class Meta:
|
|
verbose_name = "Circle"
|
|
|
|
def __str__(self):
|
|
return f"{self.title}"
|
|
|
|
|
|
class LearningSequence(Page):
|
|
parent_page_types = ['learnpath.Circle']
|
|
subpage_types = ['learnpath.LearningUnit']
|
|
|
|
class Meta:
|
|
verbose_name = "Learning Sequence"
|
|
|
|
def __str__(self):
|
|
return f"{self.title}"
|
|
|
|
|
|
class LearningUnit(Page):
|
|
parent_page_types = ['learnpath.Circle']
|
|
|
|
class Meta:
|
|
verbose_name = "Learning Unit"
|
|
|
|
def __str__(self):
|
|
return f"{self.title}"
|