Index: tests/regressiontests/forms/tests.py
===================================================================
--- tests/regressiontests/forms/tests.py        (Revision 4306)
+++ tests/regressiontests/forms/tests.py        (Arbeitskopie)
@@ -1575,6 +1575,13 @@
 <p><label for="id_last_name">Last name:</label> <input type="text" name="last_name" id="id_last_name" /></p>
 <p><ul class="errorlist"><li>This field is required.</li></ul></p>
 <p><label for="id_birthday">Birthday:</label> <input type="text" name="birthday" id="id_birthday" /></p>
+>>> print p.as_div()
+<div><ul class="errorlist"><li>This field is required.</li></ul></div>
+<div><label for="id_first_name">First name:</label> <input type="text" name="first_name" id="id_first_name" /></div>
+<div><ul class="errorlist"><li>This field is required.</li></ul></div>
+<div><label for="id_last_name">Last name:</label> <input type="text" name="last_name" id="id_last_name" /></div>
+<div><ul class="errorlist"><li>This field is required.</li></ul></div>
+<div><label for="id_birthday">Birthday:</label> <input type="text" name="birthday" id="id_birthday" /></div>
 
 If you don't pass any values to the Form's __init__(), or if you pass None,
 the Form will be considered unbound and won't do any validation. Form.errors
@@ -1606,6 +1613,10 @@
 <p><label for="id_first_name">First name:</label> <input type="text" name="first_name" id="id_first_name" /></p>
 <p><label for="id_last_name">Last name:</label> <input type="text" name="last_name" id="id_last_name" /></p>
 <p><label for="id_birthday">Birthday:</label> <input type="text" name="birthday" id="id_birthday" /></p>
+>>> print p.as_div()
+<div><label for="id_first_name">First name:</label> <input type="text" name="first_name" id="id_first_name" /></div>
+<div><label for="id_last_name">Last name:</label> <input type="text" name="last_name" id="id_last_name" /></div>
+<div><label for="id_birthday">Birthday:</label> <input type="text" name="birthday" id="id_birthday" /></div>
 
 Unicode values are handled properly.
 >>> p = Person({'first_name': u'John', 'last_name': u'\u0160\u0110\u0106\u017d\u0107\u017e\u0161\u0111', 'birthday': '1940-10-9'})
@@ -1615,6 +1626,8 @@
 u'<li><label for="id_first_name">First name:</label> <input type="text" name="first_name" value="John" id="id_first_name" /></li>\n<li><label for="id_last_name">Last name:</label> <input type="text" name="last_name" value="\u0160\u0110\u0106\u017d\u0107\u017e\u0161\u0111" id="id_last_name" /></li>\n<li><label for="id_birthday">Birthday:</label> <input type="text" name="birthday" value="1940-10-9" id="id_birthday" /></li>'
 >>> p.as_p()
 u'<p><label for="id_first_name">First name:</label> <input type="text" name="first_name" value="John" id="id_first_name" /></p>\n<p><label for="id_last_name">Last name:</label> <input type="text" name="last_name" value="\u0160\u0110\u0106\u017d\u0107\u017e\u0161\u0111" id="id_last_name" /></p>\n<p><label for="id_birthday">Birthday:</label> <input type="text" name="birthday" value="1940-10-9" id="id_birthday" /></p>'
+>>> p.as_div()
+u'<div><label for="id_first_name">First name:</label> <input type="text" name="first_name" value="John" id="id_first_name" /></div>\n<div><label for="id_last_name">Last name:</label> <input type="text" name="last_name" value="\u0160\u0110\u0106\u017d\u0107\u017e\u0161\u0111" id="id_last_name" /></div>\n<div><label for="id_birthday">Birthday:</label> <input type="text" name="birthday" value="1940-10-9" id="id_birthday" /></div>'
 
 >>> p = Person({'last_name': u'Lennon'})
 >>> p.errors
@@ -1675,6 +1688,10 @@
 <p><label for="first_name_id">First name:</label> <input type="text" name="first_name" id="first_name_id" /></p>
 <p><label for="last_name_id">Last name:</label> <input type="text" name="last_name" id="last_name_id" /></p>
 <p><label for="birthday_id">Birthday:</label> <input type="text" name="birthday" id="birthday_id" /></p>
+>>> print p.as_div()
+<div><label for="first_name_id">First name:</label> <input type="text" name="first_name" id="first_name_id" /></div>
+<div><label for="last_name_id">Last name:</label> <input type="text" name="last_name" id="last_name_id" /></div>
+<div><label for="birthday_id">Birthday:</label> <input type="text" name="birthday" id="birthday_id" /></div>
 
 If auto_id is any True value whose str() does not contain '%s', the "id"
 attribute will be the name of the field.
@@ -1837,6 +1854,12 @@
 <li><label><input type="radio" id="id_language_0" value="P" name="language" /> Python</label></li>
 <li><label><input type="radio" id="id_language_1" value="J" name="language" /> Java</label></li>
 </ul></p>
+>>> print f.as_div()
+<div><label for="id_name">Name:</label> <input type="text" name="name" id="id_name" /></div>
+<div><label for="id_language_0">Language:</label> <ul>
+<li><label><input type="radio" id="id_language_0" value="P" name="language" /> Python</label></li>
+<li><label><input type="radio" id="id_language_1" value="J" name="language" /> Java</label></li>
+</ul></div>
 
 MultipleChoiceField is a special case, as its data is required to be a list:
 >>> class SongForm(Form):
@@ -2022,9 +2045,9 @@
 <tr><th>Last name:</th><td><input type="text" name="last_name" /></td></tr>
 <tr><th>Birthday:</th><td><input type="text" name="birthday" /></td></tr>
 
-HiddenInput widgets are displayed differently in the as_table(), as_ul()
-and as_p() output of a Form -- their verbose names are not displayed, and a
-separate row is not displayed. They're displayed in the last row of the
+HiddenInput widgets are displayed differently in the as_table(), as_ul(),
+as_p() and as_div() output of a Form -- their verbose names are not displayed,
+and a separate row is not displayed. They're displayed in the last row of the
 form, directly after that row's form element.
 >>> class Person(Form):
 ...     first_name = CharField()
@@ -2044,6 +2067,10 @@
 <p>First name: <input type="text" name="first_name" /></p>
 <p>Last name: <input type="text" name="last_name" /></p>
 <p>Birthday: <input type="text" name="birthday" /><input type="hidden" name="hidden_text" /></p>
+>>> print p.as_div()
+<div>First name: <input type="text" name="first_name" /></div>
+<div>Last name: <input type="text" name="last_name" /></div>
+<div>Birthday: <input type="text" name="birthday" /><input type="hidden" name="hidden_text" /></div>
 
 With auto_id set, a HiddenInput still gets an ID, but it doesn't get a label.
 >>> p = Person(auto_id='id_%s')
@@ -2059,6 +2086,10 @@
 <p><label for="id_first_name">First name:</label> <input type="text" name="first_name" id="id_first_name" /></p>
 <p><label for="id_last_name">Last name:</label> <input type="text" name="last_name" id="id_last_name" /></p>
 <p><label for="id_birthday">Birthday:</label> <input type="text" name="birthday" id="id_birthday" /><input type="hidden" name="hidden_text" id="id_hidden_text" /></p>
+>>> print p.as_div()
+<div><label for="id_first_name">First name:</label> <input type="text" name="first_name" id="id_first_name" /></div>
+<div><label for="id_last_name">Last name:</label> <input type="text" name="last_name" id="id_last_name" /></div>
+<div><label for="id_birthday">Birthday:</label> <input type="text" name="birthday" id="id_birthday" /><input type="hidden" name="hidden_text" id="id_hidden_text" /></div>
 
 If a field with a HiddenInput has errors, the as_table() and as_ul() output
 will include the error message(s) with the text "(Hidden field [fieldname]) "
@@ -2080,7 +2111,13 @@
 <p>First name: <input type="text" name="first_name" value="John" /></p>
 <p>Last name: <input type="text" name="last_name" value="Lennon" /></p>
 <p>Birthday: <input type="text" name="birthday" value="1940-10-9" /><input type="hidden" name="hidden_text" /></p>
+>>> print p.as_div()
+<div><ul class="errorlist"><li>(Hidden field hidden_text) This field is required.</li></ul></div>
+<div>First name: <input type="text" name="first_name" value="John" /></div>
+<div>Last name: <input type="text" name="last_name" value="Lennon" /></div>
+<div>Birthday: <input type="text" name="birthday" value="1940-10-9" /><input type="hidden" name="hidden_text" /></div>
 
+
 A corner case: It's possible for a form to have only HiddenInputs.
 >>> class TestForm(Form):
 ...     foo = CharField(widget=HiddenInput)
@@ -2092,6 +2129,8 @@
 <input type="hidden" name="foo" /><input type="hidden" name="bar" />
 >>> print p.as_p()
 <input type="hidden" name="foo" /><input type="hidden" name="bar" />
+>>> print p.as_div()
+<input type="hidden" name="foo" /><input type="hidden" name="bar" />
 
 A Form's fields are displayed in the same order in which they were defined.
 >>> class TestForm(Form):
Index: docs/newforms.txt
===================================================================
--- docs/newforms.txt   (Revision 4306)
+++ docs/newforms.txt   (Arbeitskopie)
@@ -376,6 +376,21 @@
     <li><label for="id_sender">Sender:</label> <input type="text" name="sender" id="id_sender" /></li>
     <li><label for="id_cc_myself">Cc myself:</label> <input type="checkbox" name="cc_myself" id="id_cc_myself" /></li>
 
+``as_div()``
+~~~~~~~~~~~
+
+``Form.as_div()`` renders the form as a series of ``<div>`` tags, with each ``<div>``
+containing one field::
+
+    >>> f = ContactForm()
+    >>> f.as_div()
+    u'<div><label for="id_subject">Subject:</label> <input id="id_subject" type="text" name="subject" maxlength="100" /></div>\n<div><label for="id_message">Message:</label> <input type="text" name="message" id="id_message" /></div>\n<div><label for="id_sender">Sender:</label> <input type="text" name="sender" id="id_sender" /></div>\n<div><label for="id_cc_myself">Cc myself:</label> <input type="checkbox" name="cc_myself" id="id_cc_myself" /></div>'
+    >>> print f.as_div()
+    <div><label for="id_subject">Subject:</label> <input id="id_subject" type="text" name="subject" maxlength="100" /></div>
+    <div><label for="id_message">Message:</label> <input type="text" name="message" id="id_message" /></div>
+    <div><label for="id_sender">Sender:</label> <input type="text" name="sender" id="id_sender" /></div>
+    <div><label for="id_cc_myself">Cc myself:</label> <input type="checkbox" name="cc_myself" id="id_cc_myself" /></div>
+
 ``as_table()``
 ~~~~~~~~~~~~~~
