1
Fork 0

Add some more custom fields

This commit is contained in:
Jake Howard 2016-12-03 22:56:49 +00:00
parent d7e01f75d7
commit f8af5f0ad0
4 changed files with 19 additions and 1 deletions

View file

@ -1,5 +1,7 @@
from wagtail.wagtailcore.fields import StreamField from wagtail.wagtailcore.fields import StreamField
from wagtail.wagtailcore import blocks from wagtail.wagtailcore import blocks
from wagtail.wagtailimages.blocks import ImageChooserBlock
from wagtail.wagtaildocs.blocks import DocumentChooserBlock
def build_header_fields(): def build_header_fields():
@ -10,10 +12,15 @@ def build_header_fields():
def build_fixed_fields(): def build_fixed_fields():
return [ 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()), ('paragraph', blocks.RichTextBlock()),
('raw_html', blocks.RawHTMLBlock(label="Raw HTML")), ('raw_html', blocks.RawHTMLBlock(label="Raw HTML")),
('secret', blocks.RichTextBlock(icon="password", template='blocks/secret.html')), ('secret', blocks.RichTextBlock(icon="password", template='blocks/secret.html')),
('ul', blocks.ListBlock(blocks.CharBlock(label="List Item"), label="Unordered List")),
] ]

View file

@ -0,0 +1,3 @@
<pre class="highlight ansi-up">
{{ value }}
</pre>

View file

@ -0,0 +1 @@
<script src="https://gist.github.com/{{ value }}.js"></script>

View file

@ -0,0 +1,7 @@
{% load wagtailcore_tags %}
<ol>
{% for item in value %}
<li>{{ item }}</li>
{% endfor %}
</ol>