Ticket #4653: charfield_options.diff
File charfield_options.diff, 874 bytes (added by , 17 years ago) |
---|
-
django/db/models/fields/__init__.py
300 300 "Returns a list of tuples used as SelectField choices for this field." 301 301 first_choice = include_blank and blank_choice or [] 302 302 if self.choices: 303 return first_choice + list(self.choices) 303 lst = list(self.choices) 304 if not self.blank or blank_choice[0][0] in (str(x[0]) for x in lst): 305 return lst 306 return first_choice + lst 304 307 rel_model = self.rel.to 305 308 if hasattr(self.rel, 'get_related_field'): 306 309 lst = [(getattr(x, self.rel.get_related_field().attname), str(x)) for x in rel_model._default_manager.complex_filter(self.rel.limit_choices_to)]