summaryrefslogtreecommitdiff
path: root/tests/regressiontests/forms
diff options
context:
space:
mode:
Diffstat (limited to 'tests/regressiontests/forms')
-rw-r--r--tests/regressiontests/forms/tests/forms.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/regressiontests/forms/tests/forms.py b/tests/regressiontests/forms/tests/forms.py
index 91db44949c..a37cc2e3cb 100644
--- a/tests/regressiontests/forms/tests/forms.py
+++ b/tests/regressiontests/forms/tests/forms.py
@@ -789,6 +789,19 @@ class FormsTestCase(TestCase):
f = Person()
self.assertEqual(f['gender'].field.choices, [('f', 'Female'), ('m', 'Male')])
+ def test_validators_independence(self):
+ """ Test that we are able to modify a form field validators list without polluting
+ other forms """
+ from django.core.validators import MaxValueValidator
+ class MyForm(Form):
+ myfield = CharField(max_length=25)
+
+ f1 = MyForm()
+ f2 = MyForm()
+
+ f1.fields['myfield'].validators[0] = MaxValueValidator(12)
+ self.assertFalse(f1.fields['myfield'].validators[0] == f2.fields['myfield'].validators[0])
+
def test_hidden_widget(self):
# 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