diff options
| author | Srinivas Reddy Thatiparthy <thatiparthysreenivas@gmail.com> | 2017-07-13 20:25:32 +0530 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2017-07-14 13:06:51 -0400 |
| commit | 5debbdfcc84266703191e084914998e38f5f52eb (patch) | |
| tree | 8595d4e155a38ead719dd958db1833aada4c54a4 /tests/model_forms | |
| parent | 2e9ada15510e5729c331d7383fc9827e9082a8a9 (diff) | |
Fixed #28387 -- Fixed has_changed() for disabled form fields that subclass it.
Diffstat (limited to 'tests/model_forms')
| -rw-r--r-- | tests/model_forms/tests.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/model_forms/tests.py b/tests/model_forms/tests.py index 9a4ca57786..578ef00696 100644 --- a/tests/model_forms/tests.py +++ b/tests/model_forms/tests.py @@ -1702,6 +1702,10 @@ class ModelChoiceFieldTests(TestCase): ['Select a valid choice. That choice is not one of the available choices.'] ) + def test_disabled_modelchoicefield_has_changed(self): + field = forms.ModelChoiceField(Author.objects.all(), disabled=True) + self.assertIs(field.has_changed('x', 'y'), False) + def test_disabled_multiplemodelchoicefield(self): class ArticleForm(forms.ModelForm): categories = forms.ModelMultipleChoiceField(Category.objects.all(), required=False) @@ -1727,6 +1731,10 @@ class ModelChoiceFieldTests(TestCase): self.assertEqual(form.errors, {}) self.assertEqual([x.pk for x in form.cleaned_data['categories']], [category1.pk]) + def test_disabled_modelmultiplechoicefield_has_changed(self): + field = forms.ModelMultipleChoiceField(Author.objects.all(), disabled=True) + self.assertIs(field.has_changed('x', 'y'), False) + def test_modelchoicefield_iterator(self): """ Iterator defaults to ModelChoiceIterator and can be overridden with |
