In my opinion:
def delete_payment(request, id):
thePayment = Payment.objects.filter(id=id)
thePayment.delete()
return HttpResponseRedirect('/invoices/open/')
In my model:
def delete(self, *args, **kwargs):
raise Exception('foo')
super(Payment, self).delete(*args, **kwargs)
I find that an exception does not occur unless I remove the instance from the administrator view. That is, I cannot get delete () to be called correctly if I use my own view.
source
share