Skip to content Skip to sidebar Skip to footer

Django Rest Framework Datatables Delete

Issue I would like to send a list of ID's to the Django Rest Framework API url (which is the rest_framework routers default). So far everything is working up to the point of sendin

Solution 1:

You need to start to break down the logic to figure out what is not working.

  1. 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?

  2. 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"