2👍
✅
The issue is you’re getting a string with
objectsToBeDeleted = request.POST['imagesToBeRemoved']
Since you’re POSTing multiple data what you want is:
objectsToBeDeleted = request.POST.getlist('imagesToBeRemoved')
Strings are iterable so you iterate over each of the digits, that is, if you want to delete an item with an id of 345, it’ll actually try to delete the items with ids of 3, 4, and 5.
Source:stackexchange.com