FormData and Django: How to pass empty array
I have email_list
field in my form
If there are no emails entered as Json payload i can send it as:
{
email_list: []
}
Where as with FormData how to send it.
I am thinking something like this
if (data["email_list"].length === 0) {
formData.append("email_list", []);
}
data["email_list"].forEach((item) => {
formData.append("email_list", item);
});
Am i doing the right way
I checked the data i recieved in the django backend
print(request.POST.getlist('email_list'))
it prints
[""]
i want it to be
[]