如以下代码所示,一旦验证,我将尝试保存表单集。但我总是object has no attribute 'save'
出错。如果有人可以帮助我FormSetView
使用表单来保存和更新数据,那就太好了。
from extra_views import FormSetView
from foo.forms import MyForm
class MyFormSetView(FormSetView):
template_name = 'myformset.html'
form_class = MyForm
success_url = 'success/'
def formset_valid(self, formset):
formset.save()
return super(MyFormSetView, self).formset_valid(formset)