mirror of
https://github.com/django/django.git
synced 2025-08-03 18:38:50 +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:
parent
3a148f958d
commit
0034e9af18
5 changed files with 52 additions and 9 deletions
|
@ -37,6 +37,18 @@ class SplitDateTimeWidgetTest(WidgetTest):
|
|||
'<input type="text" class="pretty" value="07:30:00" name="date_1" />'
|
||||
))
|
||||
|
||||
def test_constructor_different_attrs(self):
|
||||
html = (
|
||||
'<input type="text" class="foo" value="2006-01-10" name="date_0" />'
|
||||
'<input type="text" class="bar" value="07:30:00" name="date_1" />'
|
||||
)
|
||||
widget = SplitDateTimeWidget(date_attrs={'class': 'foo'}, time_attrs={'class': 'bar'})
|
||||
self.check_html(widget, 'date', datetime(2006, 1, 10, 7, 30), html=html)
|
||||
widget = SplitDateTimeWidget(date_attrs={'class': 'foo'}, attrs={'class': 'bar'})
|
||||
self.check_html(widget, 'date', datetime(2006, 1, 10, 7, 30), html=html)
|
||||
widget = SplitDateTimeWidget(time_attrs={'class': 'bar'}, attrs={'class': 'foo'})
|
||||
self.check_html(widget, 'date', datetime(2006, 1, 10, 7, 30), html=html)
|
||||
|
||||
def test_formatting(self):
|
||||
"""
|
||||
Use 'date_format' and 'time_format' to change the way a value is
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue