我有一个一对一的关系模型,当我从模板的address_form获取字段“ name”时,它仅以字符串形式显示“ address_form”,而以html显示输入标签。
class AddressForm(ModelForm):
class Meta:
model = Address
include = ['name', 'phone', 'address', 'zip_code']
class EmployeesForm(ModelForm):
class Meta:
model = Employee
include = ['name', 'birthday']
address_form = ModelFormField(AddressForm)
和在模板中
{{form.employee_form.name}}
在浏览器中打印此“ employee_form”
但是奇怪的是
{{form.name}}
使用html打印输入标签