summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2016-01-28 13:49:51 -0500
committerTim Graham <timograham@gmail.com>2016-01-28 18:43:48 -0500
commit04564eb74d2d92eaf88b22ab8cec7ef45978111e (patch)
tree8dd1e962987d77af72557d00969c00e832c42a15 /tests
parent4b0118465b485e068a8d9ead2384fcc2ac741f06 (diff)
Fixed #26129 -- Made invalid forms display initial values of disabled fields.
Diffstat (limited to 'tests')
-rw-r--r--tests/forms_tests/tests/test_forms.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/forms_tests/tests/test_forms.py b/tests/forms_tests/tests/test_forms.py
index 917b5c99d2..00d2045786 100644
--- a/tests/forms_tests/tests/test_forms.py
+++ b/tests/forms_tests/tests/test_forms.py
@@ -718,6 +718,14 @@ class FormsTestCase(SimpleTestCase):
{'birthday': datetime.date(1974, 8, 16), 'name': 'John Doe'}
)
+ # Initial data remains present on invalid forms.
+ data = {}
+ f1 = PersonForm(data, initial={'birthday': datetime.date(1974, 8, 16)})
+ f2 = PersonFormFieldInitial(data)
+ for form in (f1, f2):
+ self.assertFalse(form.is_valid())
+ self.assertEqual(form['birthday'].value(), datetime.date(1974, 8, 16))
+
def test_hidden_data(self):
class SongForm(Form):
name = CharField()