From dc3d26bb597070a52927201d1ec13534673fa732 Mon Sep 17 00:00:00 2001 From: Jannis Leidel Date: Sun, 17 Jan 2010 22:11:23 +0000 Subject: [PATCH] [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 --- AUTHORS | 1 + django/forms/widgets.py | 2 ++ tests/regressiontests/forms/forms.py | 10 ++++++++++ 3 files changed, 13 insertions(+) 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 Guilherme Mesquita Gondim Mario Gonzalez + David Gouldin pradeep.gowda@gmail.com Collin Grady Simon Greenhill 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 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() +# 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'' + """