feat(home/models.py): add allowed_groups field to CoursePage
This commit is contained in:
@@ -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.fields import RichTextField
|
||||||
|
from wagtail.models import Page
|
||||||
|
|
||||||
|
|
||||||
class HomePage(Page):
|
class HomePage(Page):
|
||||||
@@ -10,8 +13,19 @@ class HomePage(Page):
|
|||||||
|
|
||||||
class CoursePage(Page):
|
class CoursePage(Page):
|
||||||
body = RichTextField(blank=True)
|
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):
|
class CourseModulePage(Page):
|
||||||
|
|||||||
Reference in New Issue
Block a user