[Fixed]-Why is my request.post object not mutable after calling .copy()?

1👍

From what you said, I’ve edited your view according to what I think the way should be,
I don’t know if this work or not, but certainly help you understand some things.

You don’t need to make request.POST mutable, for getting a data.

def SerialMulti(request):
    if request.method == "POST":
        form = SerialInstanceForm(request.POST)
        if form.is_valid():
            scanner_input = request.POST.get('scanner_input')
            scanner_input_list = scanner_input.splitlines()

            for i in range(0, len(scanner_input_list)):
                #edited here to make multiple instances save.
                post = ProductSerialInstance.objects.create(**form.cleaned_data)
                post.product_id = scanner_input[i]
                post.save()

        return render(request, 'serial_multi.html', {'form': form})
    else:
        form = SerialInstanceForm()
    return render(request, 'serial_multi.html', {'form': form})

Leave a comment