Skip to content

Latest commit

 

History

History
57 lines (41 loc) · 1.43 KB

care_card.md

File metadata and controls

57 lines (41 loc) · 1.43 KB

Care Card

from wagtail.core.models import Page
from wagtail.core.fields import StreamField

from wagtailnhsukfrontend.blocks import CareCardBlock

class MyPage(Page):
  body = StreamField([
      ...
      ('care_card', CareCardBlock()),
      ...
  ])

By default, the care card block can contain the following sub-blocks:

To add extra sub-blocks, you must extend the CareCardBlock class.

class CustomCareCardBody(CareCardBlock.BodyStreamBlock):

  # Add a custom block
  extra = MyExtraBlock()


class CustomCareCardBlock(CareCardBlock):

  body = CustomCareCardBody(required=True)


class MyPage(Page):
  body = StreamField([
      ...
      ('care_card', CustomCareCardBlock()),
      ...
  ])

Default Heading Level

The default heading level for care cards is 3 but this can be overwritten using a Django setting. See testapp/testapp/settings/base.py as an example. If no setting is supplied the default will remain 3.

Reference