Ticket #769: fields.diff
File fields.diff, 2.3 KB (added by , 19 years ago) |
---|
-
core/meta/fields.py
224 224 if self.maxlength and not self.choices: # Don't give SelectFields a maxlength parameter. 225 225 params['maxlength'] = self.maxlength 226 226 if isinstance(self.rel, ManyToOne): 227 params['member_name'] = name_prefix + self. get_db_column()227 params['member_name'] = name_prefix + self.attname 228 228 if self.rel.raw_id_admin: 229 229 field_objs = self.get_manipulator_field_objs() 230 230 params['validator_list'].append(curry(manipulator_valid_rel_key, self, manipulator)) … … 312 312 if self.choices: 313 313 return first_choice + list(self.choices) 314 314 rel_obj = self.rel.to 315 return first_choice + [(getattr(x, rel_obj.pk.att list), str(x)) for x in rel_obj.get_model_module().get_list(**self.rel.limit_choices_to)]315 return first_choice + [(getattr(x, rel_obj.pk.attname), str(x)) for x in rel_obj.get_model_module().get_list(**self.rel.limit_choices_to)] 316 316 317 317 def get_choices_default(self): 318 318 if(self.radio_admin): … … 332 332 "flattened" string values for the admin view. Obj is the instance to extract the 333 333 values from. 334 334 """ 335 return { self. get_db_column(): self._get_val_from_obj(obj)}335 return { self.attname: self._get_val_from_obj(obj)} 336 336 337 337 def get_follow(self, override=None): 338 338 if override != None: … … 409 409 410 410 def flatten_data(self, follow, obj = None): 411 411 val = self._get_val_from_obj(obj) 412 return {self. get_db_column(): (val is not None and val.strftime("%Y-%m-%d") or '')}412 return {self.attname: (val is not None and val.strftime("%Y-%m-%d") or '')} 413 413 414 414 class DateTimeField(DateField): 415 415 def get_db_prep_save(self, value): … … 639 639 640 640 def flatten_data(self,follow, obj = None): 641 641 val = self._get_val_from_obj(obj) 642 return {self. get_db_column(): (val is not None and val.strftime("%H:%M:%S") or '')}642 return {self.attname: (val is not None and val.strftime("%H:%M:%S") or '')} 643 643 644 644 class URLField(Field): 645 645 def __init__(self, verbose_name=None, name=None, verify_exists=True, **kwargs):