summaryrefslogtreecommitdiff
path: root/tests/regressiontests/forms
diff options
context:
space:
mode:
authorAdrian Holovaty <adrian@holovaty.com>2007-01-20 20:34:35 +0000
committerAdrian Holovaty <adrian@holovaty.com>2007-01-20 20:34:35 +0000
commit23b628d731b69b1cbdddc16417e109bdfe9497e1 (patch)
treec5e8597493b711287096ac3d174bb2844f4014d1 /tests/regressiontests/forms
parent5b5930f0df72fbb55fc569cb523217a3b6916762 (diff)
newforms-admin: Merged to [4370]
git-svn-id: http://code.djangoproject.com/svn/django/branches/newforms-admin@4371 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests/regressiontests/forms')
-rw-r--r--tests/regressiontests/forms/tests.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/regressiontests/forms/tests.py b/tests/regressiontests/forms/tests.py
index 2ae10dc0d6..336edf6cb7 100644
--- a/tests/regressiontests/forms/tests.py
+++ b/tests/regressiontests/forms/tests.py
@@ -2593,6 +2593,15 @@ field an "id" attribute.
<input type="submit" />
</form>
+The label_tag() method takes an optional attrs argument: a dictionary of HTML
+attributes to add to the <label> tag.
+>>> f = UserRegistration(auto_id='id_%s')
+>>> for bf in f:
+... print bf.label_tag(attrs={'class': 'pretty'})
+<label for="id_username" class="pretty">Username</label>
+<label for="id_password1" class="pretty">Password1</label>
+<label for="id_password2" class="pretty">Password2</label>
+
To display the errors that aren't associated with a particular field -- e.g.,
the errors caused by Form.clean() -- use {{ form.non_field_errors }} in the
template. If used on its own, it is displayed as a <ul> (or an empty string, if