mirror of
https://github.com/Hopiu/wagtail.git
synced 2026-04-30 11:34:49 +00:00
Rename table_block.fields to table_block.blocks
This commit is contained in:
parent
737731de0c
commit
8d5d29c2f3
3 changed files with 10 additions and 11 deletions
|
|
@ -24,9 +24,9 @@ Add ``"wagtail.contrib.table_block"`` to your INSTALLED_APPS:
|
|||
Basic Usage
|
||||
-----------
|
||||
|
||||
After installation the TableBlock module can be used in a similar fashion to other StreamField blocks in the Wagtail core.
|
||||
After installation the TableBlock module can be used in a similar fashion to other StreamField blocks in the Wagtail core.
|
||||
|
||||
Just import the TableBlock ``from wagtail.contrib.table_block.fields import TableBlock`` and add it to your StreamField declaration.
|
||||
Just import the TableBlock ``from wagtail.contrib.table_block.blocks import TableBlock`` and add it to your StreamField declaration.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
|
|
@ -64,20 +64,20 @@ When defining a TableBlock, Wagtail provides the ability to pass an optional ``t
|
|||
Configuration Options
|
||||
^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Every key in the ``table_options`` dictionary maps to a `handsontable <https://handsontable.com/>`_ option. These settings can be changed to alter the behaviour of tables in Wagtail. The following options are available:
|
||||
Every key in the ``table_options`` dictionary maps to a `handsontable <https://handsontable.com/>`_ option. These settings can be changed to alter the behaviour of tables in Wagtail. The following options are available:
|
||||
|
||||
* `minSpareRows <https://docs.handsontable.com/0.24.3/Options.html#minSpareRows>`_ - The number of rows to append to the end of an empty grid. The default setting is 0.
|
||||
* `startRows <https://docs.handsontable.com/0.24.3/Options.html#startRows>`_ - The default number of rows for a new table.
|
||||
* `startCols <https://docs.handsontable.com/0.24.3/Options.html#startCols>`_ - The default number of columns for new tables.
|
||||
* `startRows <https://docs.handsontable.com/0.24.3/Options.html#startRows>`_ - The default number of rows for a new table.
|
||||
* `startCols <https://docs.handsontable.com/0.24.3/Options.html#startCols>`_ - The default number of columns for new tables.
|
||||
* `colHeaders <https://docs.handsontable.com/0.24.3/Options.html#colHeaders>`_ - Can be set to ``True`` or ``False``. This setting designates if new tables should be created with column rows. **Note:** this only sets the behaviour for newly created tables. Page editors can override this by checking the the “Column header” checkbox in the table editor in the Wagtail admin.
|
||||
* `rowHeaders <https://docs.handsontable.com/0.24.3/Options.html#rowHeaders>`_ - Operates the same as colHeaders to designate if new tables should be created with the first row as a header. Just like colHeaders this option can be overridden by the page editor in the Wagtail admin.
|
||||
* `rowHeaders <https://docs.handsontable.com/0.24.3/Options.html#rowHeaders>`_ - Operates the same as colHeaders to designate if new tables should be created with the first row as a header. Just like colHeaders this option can be overridden by the page editor in the Wagtail admin.
|
||||
* `contextMenu <https://docs.handsontable.com/0.24.3/Options.html#contextMenu>`_ - Enables or disables the handsontable right-click menu. By default this is set to ``True``.
|
||||
* `editor <https://docs.handsontable.com/0.24.3/Options.html#editor>`_ - Defines the editor used for table cells. The default setting is text.
|
||||
* `stretchH <https://docs.handsontable.com/0.24.3/Options.html#stretchH>`_ - Sets the default horizontal resizing of tables. Options include, 'none', 'last', and 'all'. By default TableBlock uses 'all' for the even resizing of columns.
|
||||
* `height <https://docs.handsontable.com/0.24.3/Options.html#height>`_ - The default height of the grid. By default TableBlock sets the height to ``108`` for the optimal appearance of new tables in the editor. This is optimized for tables with ``startRows`` set to ``3``. If you change the number of startRows in the configuration you might need to change the ``height`` setting to improve the default appearence in the editor.
|
||||
* `language <https://docs.handsontable.com/0.24.3/Options.html#language>`_ - The default language setting. By default TableBlock tries to get the language from ``django.utils.translation.get_language``. If needed, this setting can be overridden here.
|
||||
* `renderer <https://docs.handsontable.com/0.24.3/Options.html#renderer>`_ - The default setting handsontable uses to render the content of table cells.
|
||||
* `autoColumnSize <https://docs.handsontable.com/0.24.3/Options.html#autoColumnSize>`_ - Enables or disables the autoColumnSize plugin. The TableBlock default setting is ``False``.
|
||||
* `language <https://docs.handsontable.com/0.24.3/Options.html#language>`_ - The default language setting. By default TableBlock tries to get the language from ``django.utils.translation.get_language``. If needed, this setting can be overridden here.
|
||||
* `renderer <https://docs.handsontable.com/0.24.3/Options.html#renderer>`_ - The default setting handsontable uses to render the content of table cells.
|
||||
* `autoColumnSize <https://docs.handsontable.com/0.24.3/Options.html#autoColumnSize>`_ - Enables or disables the autoColumnSize plugin. The TableBlock default setting is ``False``.
|
||||
|
||||
A `complete list of handsontable options <https://docs.handsontable.com/0.24.3/Options.html>`_ can be found on the handsontable website.
|
||||
|
||||
|
|
@ -107,4 +107,3 @@ To change the default table options just pass a new table_options dictionary whe
|
|||
class DemoStreamBlock(StreamBlock):
|
||||
...
|
||||
table = TableBlock(table_options=new_table_options)
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ from __future__ import absolute_import, unicode_literals
|
|||
from django.test import TestCase
|
||||
from django.utils.html import escape
|
||||
|
||||
from wagtail.contrib.table_block.fields import TableBlock
|
||||
from wagtail.contrib.table_block.blocks import TableBlock
|
||||
|
||||
|
||||
def tiny_escape(val):
|
||||
|
|
|
|||
Loading…
Reference in a new issue