commit 1d34921fa970a12c6c2869a526fb766c1d4adea4
Author: Claude Paroz <claude@2xlibre.net>
Date:   Sat Oct 22 17:43:41 2011 +0200

    Add newline as first textarea content

diff --git a/django/forms/widgets.py b/django/forms/widgets.py
index 5b50f37..a5edda7 100644
--- a/django/forms/widgets.py
+++ b/django/forms/widgets.py
@@ -368,7 +368,7 @@ class Textarea(Widget):
     def render(self, name, value, attrs=None):
         if value is None: value = ''
         final_attrs = self.build_attrs(attrs, name=name)
-        return mark_safe(u'<textarea%s>%s</textarea>' % (flatatt(final_attrs),
+        return mark_safe(u'<textarea%s>\n%s</textarea>' % (flatatt(final_attrs),
                 conditional_escape(force_unicode(value))))
 
 class DateInput(Input):
diff --git a/tests/modeltests/model_forms/tests.py b/tests/modeltests/model_forms/tests.py
index c4abdbb..6484ab3 100644
--- a/tests/modeltests/model_forms/tests.py
+++ b/tests/modeltests/model_forms/tests.py
@@ -346,7 +346,7 @@ class TestWidgets(TestCase):
         frm = TestWidgetForm()
         self.assertEqual(
             str(frm['name']),
-            '<textarea id="id_name" rows="10" cols="40" name="name"></textarea>'
+            '<textarea id="id_name" rows="10" cols="40" name="name">\n</textarea>'
         )
         self.assertEqual(
             str(frm['url']),
@@ -661,7 +661,7 @@ class OldFormForXTests(TestCase):
 <option value="%s">Bob Woodward</option>
 <option value="%s">Mike Royko</option>
 </select></td></tr>
-<tr><th>Article:</th><td><textarea rows="10" cols="40" name="article"></textarea></td></tr>
+<tr><th>Article:</th><td><textarea rows="10" cols="40" name="article">\n</textarea></td></tr>
 <tr><th>Categories:</th><td><select multiple="multiple" name="categories">
 <option value="%s">Entertainment</option>
 <option value="%s">It&#39;s a test</option>
@@ -709,7 +709,7 @@ class OldFormForXTests(TestCase):
 <option value="%s">Bob Woodward</option>
 <option value="%s" selected="selected">Mike Royko</option>
 </select></li>
-<li>Article: <textarea rows="10" cols="40" name="article">Hello.</textarea></li>
+<li>Article: <textarea rows="10" cols="40" name="article">\nHello.</textarea></li>
 <li>Categories: <select multiple="multiple" name="categories">
 <option value="%s">Entertainment</option>
 <option value="%s">It&#39;s a test</option>
@@ -763,7 +763,7 @@ class OldFormForXTests(TestCase):
 <option value="%s">Bob Woodward</option>
 <option value="%s" selected="selected">Mike Royko</option>
 </select></li>
-<li>Article: <textarea rows="10" cols="40" name="article">Hello.</textarea></li>
+<li>Article: <textarea rows="10" cols="40" name="article">\nHello.</textarea></li>
 <li>Categories: <select multiple="multiple" name="categories">
 <option value="%s" selected="selected">Entertainment</option>
 <option value="%s">It&#39;s a test</option>
@@ -791,7 +791,7 @@ class OldFormForXTests(TestCase):
 <option value="%s">Bob Woodward</option>
 <option value="%s">Mike Royko</option>
 </select></li>
-<li>Article: <textarea rows="10" cols="40" name="article"></textarea></li>
+<li>Article: <textarea rows="10" cols="40" name="article">\n</textarea></li>
 <li>Categories: <select multiple="multiple" name="categories">
 <option value="%s" selected="selected">Entertainment</option>
 <option value="%s" selected="selected">It&#39;s a test</option>
@@ -885,7 +885,7 @@ class OldFormForXTests(TestCase):
 <option value="%s">Bob Woodward</option>
 <option value="%s">Mike Royko</option>
 </select></li>
-<li>Article: <textarea rows="10" cols="40" name="article"></textarea></li>
+<li>Article: <textarea rows="10" cols="40" name="article">\n</textarea></li>
 <li>Categories: <select multiple="multiple" name="categories">
 <option value="%s">Entertainment</option>
 <option value="%s">It&#39;s a test</option>
@@ -911,7 +911,7 @@ class OldFormForXTests(TestCase):
 <option value="%s">Carl Bernstein</option>
 <option value="%s">Mike Royko</option>
 </select></li>
-<li>Article: <textarea rows="10" cols="40" name="article"></textarea></li>
+<li>Article: <textarea rows="10" cols="40" name="article">\n</textarea></li>
 <li>Categories: <select multiple="multiple" name="categories">
 <option value="%s">Entertainment</option>
 <option value="%s">It&#39;s a test</option>
diff --git a/tests/regressiontests/forms/tests/forms.py b/tests/regressiontests/forms/tests/forms.py
index 91db449..d38ede2 100644
--- a/tests/regressiontests/forms/tests/forms.py
+++ b/tests/regressiontests/forms/tests/forms.py
@@ -282,11 +282,11 @@ class FormsTestCase(TestCase):
 
         f = ContactForm(auto_id=False)
         self.assertEqual(str(f['subject']), '<input type="text" name="subject" />')
-        self.assertEqual(str(f['message']), '<textarea rows="10" cols="40" name="message"></textarea>')
+        self.assertEqual(str(f['message']), '<textarea rows="10" cols="40" name="message">\n</textarea>')
 
         # as_textarea(), as_text() and as_hidden() are shortcuts for changing the output
         # widget type:
-        self.assertEqual(f['subject'].as_textarea(), u'<textarea rows="10" cols="40" name="subject"></textarea>')
+        self.assertEqual(f['subject'].as_textarea(), u'<textarea rows="10" cols="40" name="subject">\n</textarea>')
         self.assertEqual(f['message'].as_text(), u'<input type="text" name="message" />')
         self.assertEqual(f['message'].as_hidden(), u'<input type="hidden" name="message" />')
 
@@ -296,13 +296,13 @@ class FormsTestCase(TestCase):
             message = CharField(widget=Textarea(attrs={'rows': 80, 'cols': 20}))
 
         f = ContactForm(auto_id=False)
-        self.assertEqual(str(f['message']), '<textarea rows="80" cols="20" name="message"></textarea>')
+        self.assertEqual(str(f['message']), '<textarea rows="80" cols="20" name="message">\n</textarea>')
 
         # Instance-level attrs are *not* carried over to as_textarea(), as_text() and
         # as_hidden():
         self.assertEqual(f['message'].as_text(), u'<input type="text" name="message" />')
         f = ContactForm({'subject': 'Hello', 'message': 'I love you.'}, auto_id=False)
-        self.assertEqual(f['subject'].as_textarea(), u'<textarea rows="10" cols="40" name="subject">Hello</textarea>')
+        self.assertEqual(f['subject'].as_textarea(), u'<textarea rows="10" cols="40" name="subject">\nHello</textarea>')
         self.assertEqual(f['message'].as_text(), u'<input type="text" name="message" value="I love you." />')
         self.assertEqual(f['message'].as_hidden(), u'<input type="hidden" name="message" value="I love you." />')
 
diff --git a/tests/regressiontests/forms/tests/widgets.py b/tests/regressiontests/forms/tests/widgets.py
index 2424bea..8830db1 100644
--- a/tests/regressiontests/forms/tests/widgets.py
+++ b/tests/regressiontests/forms/tests/widgets.py
@@ -164,23 +164,23 @@ class FormsWidgetTestCase(TestCase):
 
     def test_textarea(self):
         w = Textarea()
-        self.assertEqual(w.render('msg', ''), u'<textarea rows="10" cols="40" name="msg"></textarea>')
-        self.assertEqual(w.render('msg', None), u'<textarea rows="10" cols="40" name="msg"></textarea>')
-        self.assertEqual(w.render('msg', 'value'), u'<textarea rows="10" cols="40" name="msg">value</textarea>')
-        self.assertEqual(w.render('msg', 'some "quoted" & ampersanded value'), u'<textarea rows="10" cols="40" name="msg">some &quot;quoted&quot; &amp; ampersanded value</textarea>')
-        self.assertEqual(w.render('msg', mark_safe('pre &quot;quoted&quot; value')), u'<textarea rows="10" cols="40" name="msg">pre &quot;quoted&quot; value</textarea>')
-        self.assertEqual(w.render('msg', 'value', attrs={'class': 'pretty', 'rows': 20}), u'<textarea class="pretty" rows="20" cols="40" name="msg">value</textarea>')
+        self.assertEqual(w.render('msg', ''), u'<textarea rows="10" cols="40" name="msg">\n</textarea>')
+        self.assertEqual(w.render('msg', None), u'<textarea rows="10" cols="40" name="msg">\n</textarea>')
+        self.assertEqual(w.render('msg', 'value'), u'<textarea rows="10" cols="40" name="msg">\nvalue</textarea>')
+        self.assertEqual(w.render('msg', 'some "quoted" & ampersanded value'), u'<textarea rows="10" cols="40" name="msg">\nsome &quot;quoted&quot; &amp; ampersanded value</textarea>')
+        self.assertEqual(w.render('msg', mark_safe('pre &quot;quoted&quot; value')), u'<textarea rows="10" cols="40" name="msg">\npre &quot;quoted&quot; value</textarea>')
+        self.assertEqual(w.render('msg', 'value', attrs={'class': 'pretty', 'rows': 20}), u'<textarea class="pretty" rows="20" cols="40" name="msg">\nvalue</textarea>')
 
         # You can also pass 'attrs' to the constructor:
         w = Textarea(attrs={'class': 'pretty'})
-        self.assertEqual(w.render('msg', ''), u'<textarea rows="10" cols="40" name="msg" class="pretty"></textarea>')
-        self.assertEqual(w.render('msg', 'example'), u'<textarea rows="10" cols="40" name="msg" class="pretty">example</textarea>')
+        self.assertEqual(w.render('msg', ''), u'<textarea rows="10" cols="40" name="msg" class="pretty">\n</textarea>')
+        self.assertEqual(w.render('msg', 'example'), u'<textarea rows="10" cols="40" name="msg" class="pretty">\nexample</textarea>')
 
         # 'attrs' passed to render() get precedence over those passed to the constructor:
         w = Textarea(attrs={'class': 'pretty'})
-        self.assertEqual(w.render('msg', '', attrs={'class': 'special'}), u'<textarea rows="10" cols="40" name="msg" class="special"></textarea>')
+        self.assertEqual(w.render('msg', '', attrs={'class': 'special'}), u'<textarea rows="10" cols="40" name="msg" class="special">\n</textarea>')
 
-        self.assertEqual(w.render('msg', 'ŠĐĆŽćžšđ', attrs={'class': 'fun'}), u'<textarea rows="10" cols="40" name="msg" class="fun">\u0160\u0110\u0106\u017d\u0107\u017e\u0161\u0111</textarea>')
+        self.assertEqual(w.render('msg', 'ŠĐĆŽćžšđ', attrs={'class': 'fun'}), u'<textarea rows="10" cols="40" name="msg" class="fun">\n\u0160\u0110\u0106\u017d\u0107\u017e\u0161\u0111</textarea>')
 
     def test_checkboxinput(self):
         w = CheckboxInput()
