Yes, this is possible using several different methods.
First you need to copy the method that he performed in the Django admin application, which should have a flag with a label similar to "Delete?". Then, when you process the form set later in the POST request, you check to see if the True check box is selected, and if so, delete the entry. This is probably not what you are looking for since you used the word โdynamicallyโ in the title of the question :)
So, the second, dynamic method would be to use Javascript to โhideโ the deleted entry on the page and set the delete flag to True. Then you process the set of forms in the same way as the first option above. See django-dynamic-formset for removing form code this way.
The third, dynamic way is to use Ajax, and when the delete button is clicked, JS will call delete to delete the entry, as well as remove the form set from the HTML. I cannot point you to any sample code for this, but I think the second method above is better anyway, because you can save all your authentication and standard form verification code in one place.
Van gale
source share