Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Added a comment to ModelChoiceField from [4552]

git-svn-id: http://code.djangoproject.com/svn/django/trunk@4553 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit e8f165f1f09a1578ce805e0a44117663aa172f71 1 parent ee96c7e
Adrian Holovaty authored

Showing 1 changed file with 5 additions and 1 deletion. Show diff stats Hide diff stats

  1. 6  django/newforms/models.py
6  django/newforms/models.py
@@ -139,7 +139,11 @@ def _get_choices(self):
139 139
         if hasattr(self, '_choices'):
140 140
             return self._choices
141 141
         # Otherwise, execute the QuerySet in self.queryset to determine the
142  
-        # choices dynamically.
  142
+        # choices dynamically. Return a fresh QuerySetIterator that has not
  143
+        # been consumed. Note that we're instantiating a new QuerySetIterator
  144
+        # *each* time _get_choices() is called (and, thus, each time
  145
+        # self.choices is accessed) so that we can ensure the QuerySet has not
  146
+        # been consumed.
143 147
         return QuerySetIterator(self.queryset, self.empty_label, self.cache_choices)
144 148
 
145 149
     def _set_choices(self, value):

0 notes on commit e8f165f

Please sign in to comment.
Something went wrong with that request. Please try again.