Add help_text to DecimalBlock and RegexBlock

pull/3754/merge
Tomasz Knapik 2017-08-10 15:48:30 +01:00 zatwierdzone przez Matt Westcott
rodzic c26e019ed1
commit 80c846a0cf
5 zmienionych plików z 9 dodań i 4 usunięć

Wyświetl plik

@ -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)

Wyświetl plik

@ -248,6 +248,7 @@ Contributors
* Eugene Morozov
* Levi Adler
* Edwar Baron
* Tomasz Knapik
Translators
===========

Wyświetl plik

@ -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

Wyświetl plik

@ -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
~~~~~~~~

Wyświetl plik

@ -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,