I am using Django DeleteView
to delete items in my database. I have use separate template to show the delete confirmation message, but when I press the yes button I get ProtectedError
since customer table is linked with Accounts table. Hence I want to handle the ProtectedError
and give user another message in the same template.
Here is the code I have used to perform the delete:
class Customer(DeleteView):
#Delete Customers
model = Customer
template_name = 'project_templates/delete_customer.html'
def get_success_url(self):
return reverse('inactive_customers')
It would be really great if someone can suggest me a method to handle this situation.