diff options
| author | Jannis Leidel <jannis@leidel.info> | 2010-01-09 22:34:13 +0000 |
|---|---|---|
| committer | Jannis Leidel <jannis@leidel.info> | 2010-01-09 22:34:13 +0000 |
| commit | 4700200383f69495724cffa0c8be33f16c29409a (patch) | |
| tree | a3c2513365db81a2ec7638fb56cd371f8e50aa06 | |
| parent | 341c85bed0676e4bcd762186139367549ffceabb (diff) | |
Fixed #11301 - Properly hide SplitHiddenDateTimeWidget. Thanks to David Gouldin for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12152 bcc190cf-cafb-0310-a4f2-bffc1f526a37
| -rw-r--r-- | AUTHORS | 1 | ||||
| -rw-r--r-- | django/forms/widgets.py | 2 | ||||
| -rw-r--r-- | tests/regressiontests/forms/forms.py | 11 |
3 files changed, 14 insertions, 0 deletions
@@ -185,6 +185,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 1ec17f4908..d4964b0bc6 100644 --- a/django/forms/widgets.py +++ b/django/forms/widgets.py @@ -725,6 +725,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 627f50a6fe..5f9f5dec5d 100644 --- a/tests/regressiontests/forms/forms.py +++ b/tests/regressiontests/forms/forms.py @@ -1846,4 +1846,15 @@ True </select></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" />' + """ |
