feat(models.py): add course_image property to CoursePage
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
from django.contrib.auth.models import Group
|
||||
from django.forms import CheckboxSelectMultiple
|
||||
from django.db import models
|
||||
from wagtail.admin.panels import FieldPanel
|
||||
from wagtail.fields import RichTextField
|
||||
from wagtail.models import Page
|
||||
@@ -14,6 +15,13 @@ class HomePage(Page):
|
||||
|
||||
class CoursePage(Page):
|
||||
body = RichTextField(blank=True)
|
||||
course_image = models.ForeignKey(
|
||||
"wagtailimages.Image",
|
||||
null=True,
|
||||
blank=True,
|
||||
on_delete=models.SET_NULL,
|
||||
related_name="+",
|
||||
)
|
||||
allowed_groups = ParentalManyToManyField(
|
||||
Group,
|
||||
related_name="course_pages",
|
||||
@@ -32,6 +40,7 @@ class CoursePage(Page):
|
||||
return context
|
||||
|
||||
content_panels = Page.content_panels + [
|
||||
FieldPanel("course_image"),
|
||||
FieldPanel("body"),
|
||||
FieldPanel("allowed_groups", widget=CheckboxSelectMultiple),
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user