Ticket #570: 570.diff
File 570.diff, 1.8 KB (added by , 19 years ago) |
---|
-
django/core/formfields.py
116 116 if field.field_name == key: 117 117 if hasattr(field, 'requires_data_list') and hasattr(self.data, 'getlist'): 118 118 data = self.data.getlist(field.field_name) 119 elif hasattr(field, 'db_field_name'): 120 data = self.data.get(field.db_field_name, None) 119 121 else: 120 122 data = self.data.get(field.field_name, None) 121 123 if data is None: … … 300 302 html2python = staticmethod(html2python) 301 303 302 304 class SelectField(FormField): 303 def __init__(self, field_name, choices=[], size=1, is_required=False, validator_list=[]):305 def __init__(self, field_name, db_field_name=None, choices=[], size=1, is_required=False, validator_list=[]): 304 306 self.field_name = field_name 307 if db_field_name: 308 self.db_field_name = db_field_name 305 309 # choices is a list of (value, human-readable key) tuples because order matters 306 310 self.choices, self.size, self.is_required = choices, size, is_required 307 311 self.validator_list = [self.isValidChoice] + validator_list -
django/core/meta/fields.py
188 188 else: 189 189 field_objs = [formfields.SelectField] 190 190 params['choices'] = self.get_choices() 191 params['db_field_name'] = self.get_db_column() 191 192 elif self.choices: 192 193 if self.radio_admin: 193 194 field_objs = [formfields.RadioSelectField]