I am trying to extract a posted array in Django 2.
I am posting the following:
sprints[0][id]: 5
sprints[0][name]: Test sprint 1
sprints[0][order]: 0
sprints[0][project]:
sprints[0][start]:
sprints[0][end]:
sprints[1][id]: 6
sprints[1][name]: Test sprint 2
sprints[1][order]: 1
sprints[1][project]:
sprints[1][start]:
sprints[1][end]:
This returns the data visibly
def single(request, id):
return Response(request.POST)
However this return it as an empty list ([]
).
def single(request, id):
return Response(request.POST.getlist('sprints'))
As does this.
def single(request, id):
return Response(request.POST.getlist('sprints[]'))
Why?