Ticket #11301: hide_label_splitdatetimefield.diff
File hide_label_splitdatetimefield.diff, 1.2 KB (added by , 15 years ago) |
---|
-
django/forms/widgets.py
725 725 """ 726 726 A Widget that splits datetime input into two <input type="hidden"> inputs. 727 727 """ 728 is_hidden = True 729 728 730 def __init__(self, attrs=None): 729 731 widgets = (HiddenInput(attrs=attrs), HiddenInput(attrs=attrs)) 730 732 super(SplitDateTimeWidget, self).__init__(widgets, attrs) -
tests/regressiontests/forms/forms.py
1807 1807 >>> [f.name for f in form.visible_fields()] 1808 1808 ['artist', 'name'] 1809 1809 1810 1811 # Checking that the label for SplitDateTimeField is not being displayed ##### 1812 1813 >>> from django.forms import * 1814 >>> class EventForm(Form): 1815 ... happened_at = SplitDateTimeField(widget=widgets.SplitHiddenDateTimeWidget) 1816 ... 1817 >>> form = EventForm() 1818 >>> form.as_ul() 1819 u'<input type="hidden" name="happened_at_0" id="id_happened_at_0" /><input type="hidden" name="happened_at_1" id="id_happened_at_1" />' 1820 1810 1821 """