I'm working with Django. I'm making a shopping basket with Class Based Views. Everything works correctly, but I want that when removing an item from the basket (DeleteView) a function is executed to modify the quantity of another table. I just need to know how to execute a function when confirming the deletion of an element.
class CestaDeleteView(generic.DeleteView):
model = Cesta
success_url = reverse_lazy('cestas:cesta_list_view')
@method_decorator(login_required)
def dispatch(self, *args, **kwargs):
return super(CestaDeleteView, self).dispatch(*args, **kwargs)