mirror of
https://github.com/django/django.git
synced 2025-10-31 09:41:08 +00:00
Fixed #24219 -- Moved SelectDateWidget together with the other widgets
and deprecated django.forms.extras. Thanks Berker Peksag and Tim Graham for the reviews.
This commit is contained in:
@@ -18,6 +18,8 @@ details on these changes.
|
||||
* The ``weak`` argument to ``django.dispatch.signals.Signal.disconnect()`` will
|
||||
be removed.
|
||||
|
||||
* The ``django.forms.extras`` package will be removed.
|
||||
|
||||
.. _deprecation-removed-in-2.0:
|
||||
|
||||
2.0
|
||||
|
||||
@@ -49,11 +49,10 @@ Setting arguments for widgets
|
||||
|
||||
Many widgets have optional extra arguments; they can be set when defining the
|
||||
widget on the field. In the following example, the
|
||||
:attr:`~django.forms.extras.widgets.SelectDateWidget.years` attribute is set
|
||||
for a :class:`~django.forms.extras.widgets.SelectDateWidget`::
|
||||
:attr:`~django.forms.SelectDateWidget.years` attribute is set for a
|
||||
:class:`~django.forms.SelectDateWidget`::
|
||||
|
||||
from django import forms
|
||||
from django.forms.extras.widgets import SelectDateWidget
|
||||
|
||||
BIRTH_YEAR_CHOICES = ('1980', '1981', '1982')
|
||||
FAVORITE_COLORS_CHOICES = (('blue', 'Blue'),
|
||||
@@ -61,7 +60,7 @@ for a :class:`~django.forms.extras.widgets.SelectDateWidget`::
|
||||
('black', 'Black'))
|
||||
|
||||
class SimpleForm(forms.Form):
|
||||
birth_year = forms.DateField(widget=SelectDateWidget(years=BIRTH_YEAR_CHOICES))
|
||||
birth_year = forms.DateField(widget=forms.SelectDateWidget(years=BIRTH_YEAR_CHOICES))
|
||||
favorite_colors = forms.MultipleChoiceField(required=False,
|
||||
widget=forms.CheckboxSelectMultiple, choices=FAVORITE_COLORS_CHOICES)
|
||||
|
||||
@@ -752,8 +751,6 @@ Composite widgets
|
||||
Similar to :class:`SplitDateTimeWidget`, but uses :class:`HiddenInput` for
|
||||
both date and time.
|
||||
|
||||
.. currentmodule:: django.forms.extras.widgets
|
||||
|
||||
``SelectDateWidget``
|
||||
~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
@@ -807,3 +804,9 @@ Composite widgets
|
||||
# A custom empty label with tuple
|
||||
field1 = forms.DateField(widget=SelectDateWidget(
|
||||
empty_label=("Choose Year", "Choose Month", "Choose Day"))
|
||||
|
||||
.. versionchanged:: 1.9
|
||||
|
||||
This widget used to be located in the ``django.forms.extras.widgets``
|
||||
package. It is now defined in ``django.forms.widgets`` and like the
|
||||
other widgets it can be imported directly from ``django.forms``.
|
||||
|
||||
@@ -637,7 +637,7 @@ Forms
|
||||
value.
|
||||
|
||||
* :attr:`SelectDateWidget.months
|
||||
<django.forms.extras.widgets.SelectDateWidget.months>` can be used to
|
||||
<django.forms.SelectDateWidget.months>` can be used to
|
||||
customize the wording of the months displayed in the select widget.
|
||||
|
||||
* The ``min_num`` and ``validate_min`` parameters were added to
|
||||
@@ -1378,7 +1378,7 @@ Miscellaneous
|
||||
the current class *and* on a parent ``Form``.
|
||||
|
||||
* The ``required`` argument of
|
||||
:class:`~django.forms.extras.widgets.SelectDateWidget` has been removed.
|
||||
:class:`~django.forms.SelectDateWidget` has been removed.
|
||||
This widget now respects the form field's ``is_required`` attribute like
|
||||
other widgets.
|
||||
|
||||
|
||||
@@ -336,9 +336,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.
|
||||
* :class:`~django.forms.SelectDateWidget` now accepts an
|
||||
:attr:`~django.forms.SelectDateWidget.empty_label` argument, which will
|
||||
override the top list choice label when :class:`~django.forms.DateField`
|
||||
is not required.
|
||||
|
||||
* After an :class:`~django.forms.ImageField` has been cleaned and validated, the
|
||||
``UploadedFile`` object will have an additional ``image`` attribute containing
|
||||
|
||||
@@ -187,6 +187,10 @@ Miscellaneous
|
||||
will be removed in Django 2.1. The more general ``check_expression_support()``
|
||||
should be used instead.
|
||||
|
||||
``django.forms.extras`` is deprecated. You can find
|
||||
:class:`~django.forms.SelectDateWidget` in ``django.forms.widgets``
|
||||
(or simply ``django.forms``) instead.
|
||||
|
||||
.. removed-features-1.9:
|
||||
|
||||
Features removed in 1.9
|
||||
|
||||
Reference in New Issue
Block a user