How can I get multiple values from a form where each row has the same name attribute for their columns?
I'm rendering a form in Django that is essentially an Excel spreadsheet. Thousands of rows are being dynamically rendered with data from a table in my database, with each having the same number of columns and each column having the same name attribute for their inputs.
The idea of the screen is to have a user be able to edit the data in the table and save their changes.
Given that each row has the same name attribute for their inputs, I'm running into a problem when trying to retrieve said updated data.
Right now, I'm attempting to get all of the data for a particular column upon clicking save.
def change(request):
j = request.POST["ACCOUNT_NAME"]
print(j)
return redirect('/')
I'm receiving a MultiValueDictKeyError. I have tried the following solution as well:
def change(request):
j = request.POST.getlist("ACCOUNT_NAME")
print(j)
return redirect('/')
All that this prints to the console is an empty list.
Anyone have any ideas on this? Or an easier solution that doesn't require multiple rows with the same name attribute for their input fields?