我需要在页面上显示模型的多个表单(最多10个).这是我用来完成此任务的代码.
TheFormSet = formset_factory(SomeForm, extra=10)
...
formset = TheFormSet(prefix='party')
return render_to_response('template.html', {
'formset' : formset,
})
Run Code Online (Sandbox Code Playgroud)
问题是,在我看来,Django在数据库中查询formset中的每个表单,即使它们中显示的数据是相同的.
这是Formsets的工作方式还是我做错了什么?在django中是否有解决方法或者我是否必须使用JavaScript进行解决?