Ticket #769: fields.diff

File fields.diff, 2.3 KB (added by Jeff Forcier, 19 years ago)
  • core/meta/fields.py

     
    224224        if self.maxlength and not self.choices: # Don't give SelectFields a maxlength parameter.
    225225            params['maxlength'] = self.maxlength
    226226        if isinstance(self.rel, ManyToOne):
    227             params['member_name'] = name_prefix + self.get_db_column()
     227            params['member_name'] = name_prefix + self.attname
    228228            if self.rel.raw_id_admin:
    229229                field_objs = self.get_manipulator_field_objs()
    230230                params['validator_list'].append(curry(manipulator_valid_rel_key, self, manipulator))
     
    312312        if self.choices:
    313313            return first_choice + list(self.choices)
    314314        rel_obj = self.rel.to
    315         return first_choice + [(getattr(x, rel_obj.pk.attlist), 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)]
    316316
    317317    def get_choices_default(self):
    318318        if(self.radio_admin):
     
    332332        "flattened" string values for the admin view. Obj is the instance to extract the
    333333        values from.
    334334        """
    335         return { self.get_db_column(): self._get_val_from_obj(obj)}
     335        return { self.attname: self._get_val_from_obj(obj)}
    336336
    337337    def get_follow(self, override=None):
    338338        if override != None:
     
    409409
    410410    def flatten_data(self, follow, obj = None):
    411411        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 '')}
    413413
    414414class DateTimeField(DateField):
    415415    def get_db_prep_save(self, value):
     
    639639
    640640    def flatten_data(self,follow, obj = None):
    641641        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 '')}
    643643
    644644class URLField(Field):
    645645    def __init__(self, verbose_name=None, name=None, verify_exists=True, **kwargs):
Back to Top