summaryrefslogtreecommitdiff
path: root/tests/model_forms
diff options
context:
space:
mode:
Diffstat (limited to 'tests/model_forms')
-rw-r--r--tests/model_forms/tests.py8
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):