kopia lustrzana https://github.com/wagtail/wagtail
Remove unnecessary indentation from code examples
rodzic
6012291707
commit
78389caa95
|
@ -23,11 +23,11 @@ Usage
|
|||
`TypedTableBlock` can be imported from the module `wagtail.contrib.typed_table_block.blocks` and used within a StreamField definition. Just like `StructBlock` and `StreamBlock`, it accepts a list of `(name, block_type)` tuples to use as child blocks:
|
||||
|
||||
```python
|
||||
from wagtail.contrib.typed_table_block.blocks import TypedTableBlock
|
||||
from wagtail.core import blocks
|
||||
from wagtail.images.blocks import ImageChooserBlock
|
||||
from wagtail.contrib.typed_table_block.blocks import TypedTableBlock
|
||||
from wagtail.core import blocks
|
||||
from wagtail.images.blocks import ImageChooserBlock
|
||||
|
||||
class DemoStreamBlock(blocks.StreamBlock):
|
||||
class DemoStreamBlock(blocks.StreamBlock):
|
||||
title = blocks.CharBlock()
|
||||
paragraph = blocks.RichTextBlock()
|
||||
table = TableBlock([
|
||||
|
@ -60,21 +60,21 @@ To keep the UI as simple as possible for authors, it's generally recommended to
|
|||
On your page template, the `{% include_block %}` tag (called on either the individual block, or the StreamField value as a whole) will render any typed table blocks as an HTML `<table>` element.
|
||||
|
||||
```html+django
|
||||
{% load wagtailcore_tags %}
|
||||
{% load wagtailcore_tags %}
|
||||
|
||||
{% include_block page.body %}
|
||||
{% include_block page.body %}
|
||||
```
|
||||
|
||||
Or:
|
||||
|
||||
```html+django
|
||||
{% load wagtailcore_tags %}
|
||||
{% load wagtailcore_tags %}
|
||||
|
||||
{% for block in page.body %}
|
||||
{% for block in page.body %}
|
||||
{% if block.block_type == 'table' %}
|
||||
{% include_block block %}
|
||||
{% else %}
|
||||
{# rendering for other block types #}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
```
|
||||
|
|
Ładowanie…
Reference in New Issue