DJANGO:Inlineformset指定字段/排除

时间:2011-06-20 03:37:48

标签: django django-forms

我可以通过

完成此操作
BusinessFormSet = inlineformset_factory(Address, Person, exclude = 'middlen')

如果没有,请告诉我如何指定我要渲染的字段?

1 个答案:

答案 0 :(得分:2)

是的,你可以:

https://docs.djangoproject.com/en/1.3/topics/forms/modelforms/#controlling-which-fields-are-used-with-fields-and-exclude

可是:

BusinessFormSet = inlineformset_factory(Address, Person, exclude = ['middlen'])

exclude必须是一个像列表一样的可迭代对象