Skip to content

Instantly share code, notes, and snippets.

@tBaxter
Created September 15, 2016 18:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tBaxter/9147f976ea8dd3bb6c7bfd49405cb37f to your computer and use it in GitHub Desktop.
Save tBaxter/9147f976ea8dd3bb6c7bfd49405cb37f to your computer and use it in GitHub Desktop.
class PageSection(models.Model):
columns = models.IntegerField(
default=1,
help_text="On a full-size display, how many columns would you like?"
)
section_title = models.CharField(
max_length=255,
blank=True,
null=True,
help_text="Allows you to created a headline above your blocks of content (optional)."
)
override_id = models.CharField(
'Override ID',
max_length=255,
blank=True,
null=True,
help_text="Create a custom ID as needed for React, etc.")
blocks = StreamField(
DemoStreamBlock(),
)
panels = [
FieldPanel('columns'),
FieldPanel('section_title'),
FieldPanel('override_id'),
FieldPanel('blocks'),
]
class SitePageSection(Orderable, PageSection):
page = ParentalKey('SitePage', related_name='sections')
class SitePage(Page):
hero = StreamField(
HeroStreamBlock(),
blank=True,
null=True,
help_text="Optional. Defines hero image at top of page."
)
class Meta:
verbose_name = "page"
SitePage.content_panels = [
StreamFieldPanel('hero'), # should maybe be a richtextfield.
InlinePanel('sections', label="Sections"),
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment