summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJannis Leidel <jannis@leidel.info>2010-01-17 22:11:23 +0000
committerJannis Leidel <jannis@leidel.info>2010-01-17 22:11:23 +0000
commitdc3d26bb597070a52927201d1ec13534673fa732 (patch)
tree95d626f9d44c2434e6637d9f4b913d7d1b672420
parent889c110e51946deb27fb41857cea0f2bbaa6a6a0 (diff)
[1.1.X] Fixed #11301 - Properly hide SplitHiddenDateTimeWidget. Thanks to David Gouldin for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.1.X@12242 bcc190cf-cafb-0310-a4f2-bffc1f526a37
-rw-r--r--AUTHORS1
-rw-r--r--django/forms/widgets.py2
-rw-r--r--tests/regressiontests/forms/forms.py10
3 files changed, 13 insertions, 0 deletions
diff --git a/AUTHORS b/AUTHORS
index c4eec0c02f..d1a90acfe4 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -181,6 +181,7 @@ answer newbie questions, and generally made Django that much better:
GomoX <gomo@datafull.com>
Guilherme Mesquita Gondim <semente@taurinus.org>
Mario Gonzalez <gonzalemario@gmail.com>
+ David Gouldin <dgouldin@gmail.com>
pradeep.gowda@gmail.com
Collin Grady <collin@collingrady.com>
Simon Greenhill <dev@simon.net.nz>
diff --git a/django/forms/widgets.py b/django/forms/widgets.py
index 5cadc0c64a..47ed684fbb 100644
--- a/django/forms/widgets.py
+++ b/django/forms/widgets.py
@@ -727,6 +727,8 @@ class SplitHiddenDateTimeWidget(SplitDateTimeWidget):
"""
A Widget that splits datetime input into two <input type="hidden"> inputs.
"""
+ is_hidden = True
+
def __init__(self, attrs=None):
widgets = (HiddenInput(attrs=attrs), HiddenInput(attrs=attrs))
super(SplitDateTimeWidget, self).__init__(widgets, attrs)
diff --git a/tests/regressiontests/forms/forms.py b/tests/regressiontests/forms/forms.py
index b204580131..2f210bda8f 100644
--- a/tests/regressiontests/forms/forms.py
+++ b/tests/regressiontests/forms/forms.py
@@ -1814,4 +1814,14 @@ True
>>> print MyForm()
<tr><th><label for="id_field1">Field1:</label></th><td><input id="id_field1" type="text" name="field1" maxlength="50" /><input type="hidden" name="initial-field1" id="initial-id_field1" /></td></tr>
+# Checking that the label for SplitDateTimeField is not being displayed #####
+
+>>> from django.forms import *
+>>> class EventForm(Form):
+... happened_at = SplitDateTimeField(widget=widgets.SplitHiddenDateTimeWidget)
+...
+>>> form = EventForm()
+>>> form.as_ul()
+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" />'
+
"""