1
0
mirror of https://github.com/django/django.git synced 2024-12-23 01:25:58 +00:00

Added a comment to ModelChoiceField from [4552]

git-svn-id: http://code.djangoproject.com/svn/django/trunk@4553 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Adrian Holovaty 2007-02-21 05:18:34 +00:00
parent ee96c7eb2d
commit e8f165f1f0

View File

@ -139,7 +139,11 @@ class ModelChoiceField(ChoiceField):
if hasattr(self, '_choices'):
return self._choices
# Otherwise, execute the QuerySet in self.queryset to determine the
# choices dynamically.
# choices dynamically. Return a fresh QuerySetIterator that has not
# been consumed. Note that we're instantiating a new QuerySetIterator
# *each* time _get_choices() is called (and, thus, each time
# self.choices is accessed) so that we can ensure the QuerySet has not
# been consumed.
return QuerySetIterator(self.queryset, self.empty_label, self.cache_choices)
def _set_choices(self, value):