81 lines
1.6 KiB
Python
81 lines
1.6 KiB
Python
# Create your models here.
|
|
|
|
from django.db import models
|
|
from wagtail.core.models import Page
|
|
from wagtail.admin.edit_handlers import FieldPanel
|
|
|
|
#
|
|
#
|
|
# class LearnBlock(Page):
|
|
# pass
|
|
# # id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
|
|
#
|
|
|
|
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}"
|
|
|
|
|
|
# TODO: Ordering
|
|
|
|
|
|
class Circle(Page):
|
|
description = models.TextField(default="")
|
|
|
|
parent_page_types = ['learnpath.Topic']
|
|
subpage_types = ['learnpath.LearningSequence']
|
|
|
|
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 = "homepage"
|
|
|
|
def __str__(self):
|
|
return f"{self.title}"
|
|
|
|
|
|
class LearningUnit(Page):
|
|
parent_page_types = ['learnpath.Circle']
|
|
|
|
class Meta:
|
|
verbose_name = "Learning Unig"
|
|
|
|
def __str__(self):
|
|
return f"{self.title}"
|