Ticket #7475: models.py.diff
File models.py.diff, 797 bytes (added by , 16 years ago) |
---|
-
django/newforms/models.py
285 285 def __iter__(self): 286 286 if self.field.empty_label is not None: 287 287 yield (u"", self.field.empty_label) 288 for obj in self.queryset: 288 # TODO: Support self.field.cache_choices but beware of threading issues 289 for obj in self.queryset.all(): 289 290 yield (obj.pk, self.field.label_from_instance(obj)) 290 # Clear the QuerySet cache if required.291 if not self.field.cache_choices:292 self.queryset._result_cache = None293 291 294 292 class ModelChoiceField(ChoiceField): 295 293 """A ChoiceField whose choices are a model QuerySet."""