Django Rest Framework Datatables Delete
Solution 1:
You need to start to break down the logic to figure out what is not working.
Look in the browser console ('network') tab to see what the DELETE request is being sent as. Is it being sent in the format you expect?
Make the DELETE call on its own. You can use curl, Postman, or (even better) a Django Rest Framework test etc to isolate just the API call on its own. Ensure this deletes the rows as expected. If you have a debugger running on the back-end, this will really speed up finding any issues. Once this is working you can debug the frontend.
Since you imply that the ids are not being added to the ajax request, you can use the browser developer tools Javascript debugger to set a breakpoint in the deletebutton
click logic. Step through this and you should be able to isolate the source of the problem.
Also, just a thought, but you call pluck('ID')
- should this be pluck('id')
?
Post a Comment for "Django Rest Framework Datatables Delete"