#27001: Regression in query counts using RadioSelect with ModelChoiceField
-------------------------------+--------------------
Reporter: AlexHill | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 1.10
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------
Before 1.9, I had on my list of things to look at the fact that a standard
ModelChoiceField with a RadioSelect takes two queries. Now looking at this
in 1.10, the number of queries has ballooned (to 11 queries in my simple
test case).
I've not got far in looking for a solution, but this test passes in 1.9
and fails in 1.10 and master with `AssertionError: 11 != 2 : 11 queries
executed, 2 expected`:
{{{#!python
def test_radioselect_num_queries(self):
class CategoriesForm(forms.Form):
categories = forms.ModelChoiceField(
queryset=Category.objects.all(),
widget=forms.RadioSelect
)
template = Template('{% for w in form.categories %}{{ w }}{%
endfor %}')
with self.assertNumQueries(2):
template.render(Context({'form': CategoriesForm()}))
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/27001>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/051.bdea3a7a0bad5da4d1b951be5008aabb%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.