5
我想爲兩個表單使用相同的模型並更改字段的標籤如何更改標籤?字段標籤香脆形式Django
這是我的一種形式:
class jobpostForm(forms.ModelForm):
class Meta:
model = jobpost
fields = ('job_type','title','company_name','location','country','description','start_date','end_date','how_to_apply')
widgets = {
'job_type':RadioSelect(),
'location':TextInput(attrs={'size':'70','cols': 10, 'rows': 20}),
'description': TinyMCE(attrs={'cols':'100', 'row': '80'}),
'start_date':AdminDateWidget(attrs={'readonly':'readonly'}),
'end_date':AdminDateWidget(attrs={'readonly':'readonly'}),
'how_to_apply':RadioSelect(),
}
def __init__(self, *args, **kwargs):
super(jobpostForm, self).__init__(*args, **kwargs)
self.helper = FormHelper()
self.helper.form_class = 'horizontal-form'
self.helper.form_id = 'id-jobpostform'
self.helper.form_class = 'blueForms'
self.helper.form_method = 'post'
self.helper.form_action = '/portal/next/post/'
self.helper.add_input(Submit(_('submit_addcontent'), 'Preview'))
super(jobpostForm, self).__init__(*args, **kwargs)
像我想改變「位置」到「工作地點」 ..我怎樣才能做到這一點?
我正在這樣做,但它並沒有改變標籤 – 2013-04-30 10:21:18
你如何在你的模板中顯示錶單(字段)? – arie 2013-04-30 12:05:23
顯示整個表單,例如{%crispy form%} – 2013-04-30 12:22:29