feat(home/models.py): add allowed_groups field to CoursePage

This commit is contained in:
2026-03-12 11:18:07 +01:00
parent aaffcb7a4e
commit 44ee735a2d

View File

@@ -1,5 +1,8 @@
from wagtail.models import Page
from django.contrib.auth.models import Group
from django.db import models
from wagtail.admin.panels import FieldPanel
from wagtail.fields import RichTextField
from wagtail.models import Page
class HomePage(Page):
@@ -10,8 +13,19 @@ class HomePage(Page):
class CoursePage(Page):
body = RichTextField(blank=True)
allowed_groups = models.ForeignKey(
Group,
null=True,
blank=True,
on_delete=models.SET_NULL,
related_name="course_pages",
help_text="Select a group to restrict access to this course. Non-members will be prompted to purchase the course to view modules.",
)
content_panels = Page.content_panels + ["body"]
content_panels = Page.content_panels + [
FieldPanel("body"),
FieldPanel("allowed_groups", heading="Allowed Groups"),
]
class CourseModulePage(Page):