summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Holovaty <adrian@holovaty.com>2007-02-15 22:43:43 +0000
committerAdrian Holovaty <adrian@holovaty.com>2007-02-15 22:43:43 +0000
commit4a85a75fb0e3185dc77362c16e80219dac168c05 (patch)
treef57acd80789608aff0bbccf184fdfb0c9386b1b3
parent1d5e974a4f2e116a1530c24e6df54449b8ef3c98 (diff)
Fixed #3506 -- Changed newforms BoundField.help_text to an empty string if None. Thanks for the patch, Thomas Steinacher
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4528 bcc190cf-cafb-0310-a4f2-bffc1f526a37
-rw-r--r--django/newforms/forms.py2
-rw-r--r--tests/regressiontests/forms/tests.py2
2 files changed, 3 insertions, 1 deletions
diff --git a/django/newforms/forms.py b/django/newforms/forms.py
index c5e4513f9c..e9cf4ca11c 100644
--- a/django/newforms/forms.py
+++ b/django/newforms/forms.py
@@ -218,7 +218,7 @@ class BoundField(StrAndUnicode):
self.label = pretty_name(name)
else:
self.label = self.field.label
- self.help_text = field.help_text
+ self.help_text = field.help_text or ''
def __unicode__(self):
"Renders this field as an HTML widget."
diff --git a/tests/regressiontests/forms/tests.py b/tests/regressiontests/forms/tests.py
index 5bd56109a1..c53729da46 100644
--- a/tests/regressiontests/forms/tests.py
+++ b/tests/regressiontests/forms/tests.py
@@ -3044,6 +3044,8 @@ does not have help text, nothing will be output.
<p>Password2: <input type="password" name="password2" /></p>
<input type="submit" />
</form>
+>>> Template('{{ form.password1.help_text }}').render(Context({'form': UserRegistration(auto_id=False)}))
+''
The label_tag() method takes an optional attrs argument: a dictionary of HTML
attributes to add to the <label> tag.