内联Formset行为不端

时间:2014-04-03 20:00:36

标签: django inline-formset

我有更新课堂的观点。它做到了....

@login_required
def classroom_update(request, pk):
    classroom = get_object_or_404(Classroom, pk=pk)

    StudentFormSet = inlineformset_factory(Classroom, Student, form=StudentForm, can_delete=False, extra=0)

    if request.method == 'POST':

        classroom_form = ClassroomForm(request.POST, instance=classroom)
        student_formset = StudentFormSet(request.POST, instance=classroom)

        if classroom_form.is_valid():
            if student_formset.is_valid():

....然后就在那里打破了。我明白了:

MultiValueDictKeyError at /classroom_update/1
"u'student_set-0-id'"

为什么会出现行为不端的任何想法?

0 个答案:

没有答案