feat(pages.py): add support for creating PurchasableProduct from within CoursePage
This commit is contained in:
@@ -9,7 +9,8 @@ from modelcluster.contrib.taggit import ClusterTaggableManager
|
|||||||
from modelcluster.fields import ParentalKey
|
from modelcluster.fields import ParentalKey
|
||||||
from taggit.models import TaggedItemBase
|
from taggit.models import TaggedItemBase
|
||||||
from wagtail import blocks
|
from wagtail import blocks
|
||||||
from wagtail.admin.panels import FieldPanel
|
from wagtail.admin.panels import FieldPanel, InlinePanel
|
||||||
|
|
||||||
from wagtail.fields import RichTextField, StreamField
|
from wagtail.fields import RichTextField, StreamField
|
||||||
from wagtail.images.blocks import ImageBlock
|
from wagtail.images.blocks import ImageBlock
|
||||||
from wagtail.models import Page
|
from wagtail.models import Page
|
||||||
@@ -168,6 +169,9 @@ class CoursePage(Page):
|
|||||||
FieldPanel("course_image"),
|
FieldPanel("course_image"),
|
||||||
FieldPanel("description"),
|
FieldPanel("description"),
|
||||||
FieldPanel("body"),
|
FieldPanel("body"),
|
||||||
|
InlinePanel(
|
||||||
|
"purchasable_products", label="Purchasable product", min_num=0, max_num=1
|
||||||
|
),
|
||||||
FieldPanel("allowed_groups", widget=CheckboxSelectMultiple),
|
FieldPanel("allowed_groups", widget=CheckboxSelectMultiple),
|
||||||
FieldPanel(
|
FieldPanel(
|
||||||
"repository_url",
|
"repository_url",
|
||||||
@@ -175,6 +179,7 @@ class CoursePage(Page):
|
|||||||
heading="Repository URL (auto-generated)",
|
heading="Repository URL (auto-generated)",
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
|
||||||
parent_page_types = ["home.CourseIndexPage"]
|
parent_page_types = ["home.CourseIndexPage"]
|
||||||
subpage_types = ["home.CourseModulePage"]
|
subpage_types = ["home.CourseModulePage"]
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user