Add some more custom fields
This commit is contained in:
parent
d7e01f75d7
commit
f8af5f0ad0
4 changed files with 19 additions and 1 deletions
|
@ -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")),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|
3
templates/blocks/ansi.html
Normal file
3
templates/blocks/ansi.html
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
<pre class="highlight ansi-up">
|
||||||
|
{{ value }}
|
||||||
|
</pre>
|
1
templates/blocks/gist.html
Normal file
1
templates/blocks/gist.html
Normal file
|
@ -0,0 +1 @@
|
||||||
|
<script src="https://gist.github.com/{{ value }}.js"></script>
|
7
templates/blocks/ordered-list.html
Normal file
7
templates/blocks/ordered-list.html
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
{% load wagtailcore_tags %}
|
||||||
|
|
||||||
|
<ol>
|
||||||
|
{% for item in value %}
|
||||||
|
<li>{{ item }}</li>
|
||||||
|
{% endfor %}
|
||||||
|
</ol>
|
Reference in a new issue