diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 8f7eee227a..1a7f774b1c 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -15,6 +15,7 @@ Changelog * Users can no longer remove their own active / superuser flags through Settings -> Users (Stein Strindhaug, Huub Bouma) * The `process_form_submission` method of form pages now return the created form submission object (cho-leukeleu) * Added `WAGTAILUSERS_PASSWORD_ENABLED` and `WAGTAILUSERS_PASSWORD_REQUIRED` settings to permit creating users with no Django-side passwords, to support external authentication setups (Matt Westcott) + * Added help text parameter to `DecimalBlock` and `RegexBlock` (Tomasz Knapik) * Optimised caudal oscillation parameters on logo (Jack Paine) * Fix: FieldBlocks in StreamField now call the field's `prepare_value` method (Tim Heap) * Fix: Initial disabled state of InlinePanel add button is now set correctly on non-default tabs (Matthew Downey) diff --git a/CONTRIBUTORS.rst b/CONTRIBUTORS.rst index 4e0010d0f1..00b5b04ccc 100644 --- a/CONTRIBUTORS.rst +++ b/CONTRIBUTORS.rst @@ -248,6 +248,7 @@ Contributors * Eugene Morozov * Levi Adler * Edwar Baron +* Tomasz Knapik Translators =========== diff --git a/docs/releases/1.12.rst b/docs/releases/1.12.rst index 80185b5177..ab947a7ae0 100644 --- a/docs/releases/1.12.rst +++ b/docs/releases/1.12.rst @@ -35,6 +35,7 @@ Other features * Users can no longer remove their own active / superuser flags through Settings -> Users (Stein Strindhaug, Huub Bouma) * The ``process_form_submission`` method of form pages now return the created form submission object (Christine Ho) * Added ``WAGTAILUSERS_PASSWORD_ENABLED`` and ``WAGTAILUSERS_PASSWORD_REQUIRED`` settings to permit creating users with no Django-side passwords, to support external authentication setups (Matt Westcott) + * Added help text parameter to ``DecimalBlock`` and ``RegexBlock`` (Tomasz Knapik) * Optimised caudal oscillation parameters on logo (Jack Paine) Bug fixes diff --git a/docs/topics/streamfield.rst b/docs/topics/streamfield.rst index 38bc73baba..00de5b3a19 100644 --- a/docs/topics/streamfield.rst +++ b/docs/topics/streamfield.rst @@ -122,7 +122,7 @@ DecimalBlock ``wagtail.wagtailcore.blocks.DecimalBlock`` -A single-line decimal input that validates that the value is a valid decimal number. The keyword arguments ``required``, ``max_value``, ``min_value``, ``max_digits`` and ``decimal_places`` are accepted. +A single-line decimal input that validates that the value is a valid decimal number. The keyword arguments ``required``, ``help_text``, ``max_value``, ``min_value``, ``max_digits`` and ``decimal_places`` are accepted. For an example of ``DecimalBlock`` in use, see :ref:`streamfield_personblock_example` @@ -139,7 +139,7 @@ A single-line text input that validates a string against a regex expression. The 'invalid': "Not a valid library card number." }) -The keyword arguments ``regex``, ``required``, ``max_length``, ``min_length`` and ``error_messages`` are accepted. +The keyword arguments ``regex``, ``help_text``, ``required``, ``max_length``, ``min_length`` and ``error_messages`` are accepted. URLBlock ~~~~~~~~ diff --git a/wagtail/wagtailcore/blocks/field_block.py b/wagtail/wagtailcore/blocks/field_block.py index b081b4da89..ff7b0dbe2f 100644 --- a/wagtail/wagtailcore/blocks/field_block.py +++ b/wagtail/wagtailcore/blocks/field_block.py @@ -169,10 +169,11 @@ class FloatBlock(FieldBlock): class DecimalBlock(FieldBlock): - def __init__(self, required=True, max_value=None, min_value=None, + def __init__(self, required=True, help_text=None, max_value=None, min_value=None, max_digits=None, decimal_places=None, *args, **kwargs): self.field = forms.DecimalField( required=required, + help_text=help_text, max_value=max_value, min_value=min_value, max_digits=max_digits, @@ -186,11 +187,12 @@ class DecimalBlock(FieldBlock): class RegexBlock(FieldBlock): - def __init__(self, regex, required=True, max_length=None, min_length=None, + def __init__(self, regex, required=True, help_text=None, max_length=None, min_length=None, error_messages=None, *args, **kwargs): self.field = forms.RegexField( regex=regex, required=required, + help_text=help_text, max_length=max_length, min_length=min_length, error_messages=error_messages,