summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Holovaty <adrian@holovaty.com>2007-02-21 05:18:34 +0000
committerAdrian Holovaty <adrian@holovaty.com>2007-02-21 05:18:34 +0000
commite8f165f1f09a1578ce805e0a44117663aa172f71 (patch)
tree3c3be84a8705007a461fbd192bd8a00121092ddb
parentee96c7eb2dea86e5bdaf93f7afa91b6f0128dd72 (diff)
Added a comment to ModelChoiceField from [4552]
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4553 bcc190cf-cafb-0310-a4f2-bffc1f526a37
-rw-r--r--django/newforms/models.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/django/newforms/models.py b/django/newforms/models.py
index a92d8f9b89..616c7141e7 100644
--- a/django/newforms/models.py
+++ b/django/newforms/models.py
@@ -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):