summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorgyx1000 <guillaume.pannatier@gmail.com>2014-05-29 17:15:01 +0200
committerTim Graham <timograham@gmail.com>2014-06-04 07:23:25 -0400
commit7e2c87809ca601b7290203dd54ba3e9f90a702bd (patch)
tree4ff365eda374b2c939ce88769e54f04f297e85c5 /docs
parentfb9d8f06520f495d0c36236f7534dbe660c7e164 (diff)
Fixed #22684 -- Amended SelectDateWidget.empty_label to accept a tuple of values.
Thanks danielsamuels for the report
Diffstat (limited to 'docs')
-rw-r--r--docs/ref/forms/widgets.txt19
1 files changed, 15 insertions, 4 deletions
diff --git a/docs/ref/forms/widgets.txt b/docs/ref/forms/widgets.txt
index cf309f0298..7ed235b9e3 100644
--- a/docs/ref/forms/widgets.txt
+++ b/docs/ref/forms/widgets.txt
@@ -787,9 +787,20 @@ Composite widgets
.. versionadded:: 1.8
If the :class:`~django.forms.DateField` is not required,
- :class:`SelectDateWidget` will have an empty choice at the top of
- the list. You can change the text of this label
- (which is ``---`` by default) with the ``empty_label`` attribute::
+ :class:`SelectDateWidget` will have an empty choice at the top of the
+ list (which is ``---`` by default). You can change the text of this
+ label with the ``empty_label`` attribute. ``empty_label`` can be a
+ ``string``, ``list``, or ``tuple``. When a string is used, all select
+ boxes will each have an empty choice with this label. If ``empty_label``
+ is a ``list`` or ``tuple`` of 3 string elements, the select boxes will
+ have their own custom label. The labels should be in this order
+ ``('year_label', 'month_label', 'day_label')``.
- # A custom empty label
+ .. code-block:: python
+
+ # A custom empty label with string
field1 = forms.DateField(widget=SelectDateWidget(empty_label="Nothing"))
+
+ # A custom empty label with tuple
+ field1 = forms.DateField(widget=SelectDateWidget(
+ empty_label=("Choose Year", "Choose Month", "Choose Day"))