From 32586b0ba43816d325be0ce807f75623683eed7a Mon Sep 17 00:00:00 2001 From: Guillaume Pannatier Date: Fri, 23 May 2014 09:07:15 +0200 Subject: Fixed #22684 -- Added `empty_label` option on `django.forms.extras.widets.SelectDateWidget` Thanks danielsamuels for the report --- docs/ref/forms/widgets.txt | 12 ++++++++++++ docs/releases/1.8.txt | 4 ++++ 2 files changed, 16 insertions(+) (limited to 'docs') diff --git a/docs/ref/forms/widgets.txt b/docs/ref/forms/widgets.txt index 5569e38b47..cf309f0298 100644 --- a/docs/ref/forms/widgets.txt +++ b/docs/ref/forms/widgets.txt @@ -781,3 +781,15 @@ Composite widgets 5:_('may'), 6:_('jun'), 7:_('jul'), 8:_('aug'), 9:_('sep'), 10:_('oct'), 11:_('nov'), 12:_('dec') } + + .. attribute:: SelectDateWidget.empty_label + + .. 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:: + + # A custom empty label + field1 = forms.DateField(widget=SelectDateWidget(empty_label="Nothing")) diff --git a/docs/releases/1.8.txt b/docs/releases/1.8.txt index b0e3b035c0..2fed9fa4a6 100644 --- a/docs/releases/1.8.txt +++ b/docs/releases/1.8.txt @@ -136,6 +136,10 @@ Forms a form's :attr:`~django.forms.Form.label_suffix` while using shortcuts such as ``{{ form.as_p }}`` in templates. +* :class:`~django.forms.extras.widgets.SelectDateWidget` now accepts an + :attr:`~django.forms.extras.widgets.SelectDateWidget.empty_label` argument, which will + override the top list choice label when :class:`~django.forms.DateField` is not required. + Internationalization ^^^^^^^^^^^^^^^^^^^^ -- cgit v1.3