From f8af5f0ad0ddc52c76f0b7ce42e6d43c2cc27d44 Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Sat, 3 Dec 2016 22:56:49 +0000 Subject: [PATCH] Add some more custom fields --- project/common/fields.py | 9 ++++++++- templates/blocks/ansi.html | 3 +++ templates/blocks/gist.html | 1 + templates/blocks/ordered-list.html | 7 +++++++ 4 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 templates/blocks/ansi.html create mode 100644 templates/blocks/gist.html create mode 100644 templates/blocks/ordered-list.html diff --git a/project/common/fields.py b/project/common/fields.py index 332a7ec..ac40f48 100644 --- a/project/common/fields.py +++ b/project/common/fields.py @@ -1,5 +1,7 @@ from wagtail.wagtailcore.fields import StreamField from wagtail.wagtailcore import blocks +from wagtail.wagtailimages.blocks import ImageChooserBlock +from wagtail.wagtaildocs.blocks import DocumentChooserBlock def build_header_fields(): @@ -10,10 +12,15 @@ def build_header_fields(): def build_fixed_fields(): return [ - ('list', blocks.ListBlock(blocks.CharBlock(label="List Item"), label="list-ul")), + ('ansi', blocks.TextBlock(template="blocks/ansi.html")), + ('document', DocumentChooserBlock()), + ('gist', blocks.CharBlock(template="blocks/gist.html")), + ('image', ImageChooserBlock()), + ('ol', blocks.ListBlock(blocks.CharBlock(label="List Item"), label="Ordered List", template='blocks/ordered-list.html')), ('paragraph', blocks.RichTextBlock()), ('raw_html', blocks.RawHTMLBlock(label="Raw HTML")), ('secret', blocks.RichTextBlock(icon="password", template='blocks/secret.html')), + ('ul', blocks.ListBlock(blocks.CharBlock(label="List Item"), label="Unordered List")), ] diff --git a/templates/blocks/ansi.html b/templates/blocks/ansi.html new file mode 100644 index 0000000..68f11a2 --- /dev/null +++ b/templates/blocks/ansi.html @@ -0,0 +1,3 @@ +
+  {{ value }}
+
diff --git a/templates/blocks/gist.html b/templates/blocks/gist.html new file mode 100644 index 0000000..9a41426 --- /dev/null +++ b/templates/blocks/gist.html @@ -0,0 +1 @@ + diff --git a/templates/blocks/ordered-list.html b/templates/blocks/ordered-list.html new file mode 100644 index 0000000..ccca959 --- /dev/null +++ b/templates/blocks/ordered-list.html @@ -0,0 +1,7 @@ +{% load wagtailcore_tags %} + +
    + {% for item in value %} +
  1. {{ item }}
  2. + {% endfor %} +