feat(pages.py): add per-lesson repo fields

This commit is contained in:
2026-03-30 09:46:53 +02:00
parent a2ad8e7ac9
commit 64edf6656e

View File

@@ -164,6 +164,15 @@ class CourseModulePage(Page):
class ModuleLessonPage(Page): class ModuleLessonPage(Page):
body = RichTextField(blank=True) body = RichTextField(blank=True)
create_gitea_repo = models.BooleanField(
default=False,
help_text="If enabled, a Gitea repository will be automatically created for this module when the module is published.",
)
gitea_repo_url = models.URLField(
null=True,
blank=True,
help_text="URL of the Gitea repository for this lesson (auto-generated if 'create_gitea_repo' is enabled)",
)
@property @property
def module(self): def module(self):
@@ -180,7 +189,15 @@ class ModuleLessonPage(Page):
return f"{module.full_title} - {self.title}" return f"{module.full_title} - {self.title}"
return self.title return self.title
content_panels = Page.content_panels + ["body"] content_panels = Page.content_panels + [
FieldPanel("body"),
FieldPanel("create_gitea_repo"),
FieldPanel(
"gitea_repo_url",
read_only=True,
heading="Gitea Repository URL",
),
]
parent_page_types = ["home.CourseModulePage"] parent_page_types = ["home.CourseModulePage"]