【发布时间】:2017-11-18 17:13:38
【问题描述】:
我正在尝试更改 django 表单中的字段标签,并且还想添加一个占位符,但是当我设置占位符属性时,字段标签不起作用并显示默认字段标签“work_or_study”而不是“Bio ”。 这是代码:
class ProfileEditForm(forms.ModelForm):
date_of_birth=forms.CharField(widget=forms.TextInput(attrs={'placeholder':'y-m-d'}))
work_or_study=forms.CharField(widget=forms.TextInput(attrs={'placeholder':'something interesting about you'}))
class Meta:
model= Profile
labels = {"work_or_study":"Bio"}
fields = ('date_of_birth','work_or_study')
【问题讨论】:
标签: python django django-forms django-templates