verbose_name ='家庭住址'

时间:2010-01-14 14:30:36

标签: django django-models

您好我是刚接触Google App Engine的Django。

class StudentAddress(db.Model):
  name=db.UserProperty()
  address=db.StringProperty(verbose_name='Home Address')

class StudentAddressForm(djangoforms.ModelForm):
  class Meta:
    moddel = StudentAddress  

显示表单时,详细名称如下所示:Home address

如何将显示屏编码为“家庭住址”而不是“家庭住址”? 请帮忙。

1 个答案:

答案 0 :(得分:1)

class StudentAddressForm(djangoforms.ModelForm):

  def __init__(self):
    super(StudentAddressForm, self).__init__(*args, **kwargs)
    self.fields['address'].label = 'whatever you like'

  class Meta:
    model = StudentAddress