我不断收到错误:
[u'ManagementForm data is missing or has been tampered with']
我也想不通为什么。这是我的看法:
def CreateWorkout(request):
WorkoutInlineFormSet = inlineformset_factory(workout,exercise)
if request.method == "POST" :
formset = WorkoutInlineFormSet(request.POST)
if formset.is_valid():
formset.save();
else:
formset = WorkoutInlineFormSet()
return render_to_response('submit.html',{'formset': formset},context_instance=RequestContext(request))
这是我的模板:
<body>
<form method="POST" action ="">
{{ formset.management_form }}
<table>
{% for form in formset.forms %}
{{ form }}
{% endfor %}
</table>
</form>
</body>
我读过你必须包括formset.management_form
,我有。我认为这将是一个简单的解决方案,但我一直无法找出问题所在。