[Answer]-Inlineformset_factory modify page throwing errors

1👍

In Template:

{% for form in student_formset.forms %}
    {{ form.id }} #Here , you have to pass form id
    <div class="item">
        {% crispy form %}
    </div>
{% endfor %}

Check it :Django docs

Cheers

--- Update:
You also have to pass the management form

    {{ formset.management_form }}

–Response to comment:

I had the same error too , here is the fix:

classroom = get_object_or_404(Classroom, pk=pk)
#.....
if request.method == 'POST':

        classroom_form = ClassroomForm(request.POST , instance=classroom) 
        #This is an Update View , missing to add instance , will result a new entry.

        student_formset = StudentFormSet(request.POST, instance = classroom)
        #passing the instance here would solve the list index out of range

    if classroom_form.is_valid() and student_formset.is_valid():
        classroom = classroom_form.save(commit=False)
        classroom.user = request.user
        classroom.save()
        for form in student_formset.forms:
            student = form.save(commit=False)
            student.classroom = classroom
            student.save()
        return HttpResponseRedirect('/') # Redirect to a 'success' page

Leave a comment