views:

16

answers:

1

If I go to the Django admin page and delete a user, I want it to run some code before/after it deletes the user. I know about overriding models' delete() methods, but I'm not sure how to apply it to a built-in model. Also, I'd like to be able to do it without 'subclassing' the User model and creating a (for instance) MyUser model.

Is there any way to accomplish this?

Thanks in advance!

+1  A: 

yes, you can listen to the django pre_delete and post_delete signal: here is the doc link: http://docs.djangoproject.com/en/dev/ref/signals/#django.db.models.signals.pre_delete http://docs.djangoproject.com/en/dev/ref/signals/#django.db.models.signals.post_delete

Dantario
This is exactly what I needed! Thank you!
zbar