1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Fixed #5851 -- Allowed specifying different HTML attrs for SplitDateTimeWidget subwidgets.

Thanks Tim Graham and Nick Pope for review.
This commit is contained in:
Mariusz Felisiak
2017-01-13 12:48:30 +01:00
committed by Tim Graham
parent 3a148f958d
commit 0034e9af18
5 changed files with 52 additions and 9 deletions

View File

@@ -840,7 +840,7 @@ Composite widgets
for the date, and :class:`TimeInput` for the time. Must be used with
:class:`SplitDateTimeField` rather than :class:`DateTimeField`.
``SplitDateTimeWidget`` has two optional attributes:
``SplitDateTimeWidget`` has several optional arguments:
.. attribute:: SplitDateTimeWidget.date_format
@@ -850,6 +850,16 @@ Composite widgets
Similar to :attr:`TimeInput.format`
.. attribute:: SplitDateTimeWidget.date_attrs
.. attribute:: SplitDateTimeWidget.time_attrs
.. versionadded:: 2.0
Similar to :attr:`Widget.attrs`. A dictionary containing HTML
attributes to be set on the rendered :class:`DateInput` and
:class:`TimeInput` widgets, respectively. If these attributes aren't
set, :attr:`Widget.attrs` is used instead.
``SplitHiddenDateTimeWidget``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View File

@@ -136,11 +136,14 @@ File Uploads
* ...
Forms
~~~~~
* ...
* The new ``date_attrs`` and ``time_attrs`` arguments for
:class:`~django.forms.SplitDateTimeWidget` and
:class:`~django.forms.SplitHiddenDateTimeWidget` allow specifying different
HTML attributes for the ``DateInput`` and ``TimeInput`` (or hidden)
subwidgets.
Generic Views
~~~~~~~~~~~~~