diff options
| author | Alex Hill <alex@hill.net.au> | 2016-08-03 11:12:06 +0800 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2016-08-03 10:45:55 -0400 |
| commit | c5ebfda00226e3695cadbc13ea9ce4c5951d3ed0 (patch) | |
| tree | 4142734f609dc73ce3820392a077b8a9642141ef /tests | |
| parent | 4e64e3bb6e96a50b057bc1144fba3efdee7dfc10 (diff) | |
Fixed #27001 -- Fixed a query count regression in ModelChoiceField with RadioSelect.
Diffstat (limited to 'tests')
| -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 3d65c104ff..8c706f1a56 100644 --- a/tests/model_forms/tests.py +++ b/tests/model_forms/tests.py @@ -1576,6 +1576,14 @@ class ModelChoiceFieldTests(TestCase): field = CustomModelChoiceField(Category.objects.all()) self.assertIsInstance(field.choices, CustomModelChoiceIterator) + def test_radioselect_num_queries(self): + class CategoriesForm(forms.Form): + categories = forms.ModelChoiceField(Category.objects.all(), widget=forms.RadioSelect) + + template = Template('{% for widget in form.categories %}{{ widget }}{% endfor %}') + with self.assertNumQueries(2): + template.render(Context({'form': CategoriesForm()})) + class ModelMultipleChoiceFieldTests(TestCase): def setUp(self): |
