mirror of
https://github.com/django/django.git
synced 2025-08-03 18:38:50 +00:00
[1.10.x] Fixed #26021 -- Applied hanging indentation to docs.
Backport of 4a4d7f980e
from master
This commit is contained in:
parent
971adb9e9c
commit
521772ff07
21 changed files with 185 additions and 107 deletions
|
@ -1006,16 +1006,25 @@ Slightly complex built-in ``Field`` classes
|
|||
}
|
||||
# Or define a different message for each field.
|
||||
fields = (
|
||||
CharField(error_messages={'incomplete': 'Enter a country calling code.'},
|
||||
validators=[RegexValidator(r'^[0-9]+$', 'Enter a valid country calling code.')]),
|
||||
CharField(error_messages={'incomplete': 'Enter a phone number.'},
|
||||
validators=[RegexValidator(r'^[0-9]+$', 'Enter a valid phone number.')]),
|
||||
CharField(validators=[RegexValidator(r'^[0-9]+$', 'Enter a valid extension.')],
|
||||
required=False),
|
||||
CharField(
|
||||
error_messages={'incomplete': 'Enter a country calling code.'},
|
||||
validators=[
|
||||
RegexValidator(r'^[0-9]+$', 'Enter a valid country calling code.'),
|
||||
],
|
||||
),
|
||||
CharField(
|
||||
error_messages={'incomplete': 'Enter a phone number.'},
|
||||
validators=[RegexValidator(r'^[0-9]+$', 'Enter a valid phone number.')],
|
||||
),
|
||||
CharField(
|
||||
validators=[RegexValidator(r'^[0-9]+$', 'Enter a valid extension.')],
|
||||
required=False,
|
||||
),
|
||||
)
|
||||
super(PhoneField, self).__init__(
|
||||
error_messages=error_messages, fields=fields,
|
||||
require_all_fields=False, *args, **kwargs)
|
||||
require_all_fields=False, *args, **kwargs
|
||||
)
|
||||
|
||||
.. attribute:: MultiValueField.widget
|
||||
|
||||
|
|
|
@ -62,8 +62,11 @@ widget on the field. In the following example, the
|
|||
|
||||
class SimpleForm(forms.Form):
|
||||
birth_year = forms.DateField(widget=forms.SelectDateWidget(years=BIRTH_YEAR_CHOICES))
|
||||
favorite_colors = forms.MultipleChoiceField(required=False,
|
||||
widget=forms.CheckboxSelectMultiple, choices=FAVORITE_COLORS_CHOICES)
|
||||
favorite_colors = forms.MultipleChoiceField(
|
||||
required=False,
|
||||
widget=forms.CheckboxSelectMultiple,
|
||||
choices=FAVORITE_COLORS_CHOICES,
|
||||
)
|
||||
|
||||
See the :ref:`built-in widgets` for more information about which widgets
|
||||
are available and which arguments they accept.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue