﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
27501	ModelChoiceField.queryset documentation isn't clear that this is lazily evaluated	Nick Smith	ChillarAnand	"The [https://github.com/django/django/blob/master/django/forms/models.py#L1197 comments] in `ModelChoiceField._get_choices` suggest that the `queryset` attribute is evaluated afresh every time the form is initialised, and testing confirms this:

1. load form
1. edit eligible related objects in the db
1. refresh form (without restarting the server)
1. observe field choices have changed

#22841 also supports this theory, (although the rather old #18272 suggests otherwise).

The syntax for a field of this type is:

{{{#!python
foo = forms.ModelChoiceField(
    queryset=Bar.objects.filter(baz=True)
)
}}}

Given that this looks very like a runtime-evaluated queryset, I suggest a docs amendment that clarifies the behaviour. (I am not confident in making that docs amendment myself, at least until I have properly understood the intended behaviour.)"	Cleanup/optimization	closed	Documentation	1.10	Normal	fixed			Accepted	1	1	0	0	1	0
