The `form_template` attribute was mentioned in passing in the docs, but was missing various things
to make it fully useful:
- context passed to form_template now includes 'prefix' and 'block_definition'
- context for the form is now populated in a separate overrideable `get_form_context` method
- full documentation and tests for form_template and get_form_context added
It's common in Wagtail to want to quickly override the base search settings to disable Elasticsearch in specific environments (eg CI or running imports).
To do this, you have to manually write out Wagtail's default search configuration.
This commit changes the way the default configuration is loaded, it is now loaded whenever there is no "default" backend configured rather than only loading if the ``WAGTAILSEARCH_BACKENDS`` was not defined at all.
To override a parent settings file's search backends configuration, you can now just do:
WAGTAILSEARCH_BACKENDS = {}
And the defaults will be restored
These tests haven't been run for a while due to a mistake in tox.ini. They are currently broken on master.
They broke because they require AUTO_UPDATE to be True for the Elasticsearch backend, but we recently disabled that to improve speed and reliability of the entire test suite. This commit adds a way for the tests that need AUTO_UPDATE to force it to be enabled on specific backends
The individual `error_message` kwarg on RegexField is deprecated in Django 1.8
(and removed in Django 1.10), so it's appropriate for RegexBlock to follow the
same convention.
The bugfix here is the removal of the redundant </th> tags at the top. I noticed
these while writing the Page explorability PR.
The formatting issue was the use of double quotes for python string comparisons.
That messed up the template syntax highlighting, since double quotes were
already being used around the HTML attribute values.
For example:
>>> page.body = '{"type": "text", "value": "foo"}'
>>> type(page.body)
StreamValue
Removing SubFieldBase broke this behaviour, requiring that the string is converted to a StreamValue before giving it to page.body. I initially thought that the new behaviour was the correct one (doing this convertion on set felt a little yuky), until I found a test which tests for the old behaviour: d8bceff38b/wagtail/wagtailcore/tests/test_streamfield.py (L124-L133).
So I guess it is wanted then. This commit reinstates that old behaviour borrowing some code from Django.
This adds a conftest.py module to setup the test infrastructure
correctly. It doesn't yet add pytest and pytest-django to the testing
requirements so for now it is completly optional.
This change also updates the test_migrations testcase to use a regular
TestCase baseclass instead of the TransactionTestCase. Otherwise the
following tests fail with db errors.