piokuc
piokuc

Reputation: 26204

Django: Get notified of all changes in database

I was wandering if there's a way to get notified of any changes to objects in a Django database. Right now I just need an email if anybody adds or changes anything but it would be best if I could hook a function triggered by any change and could decide what to do.

Is there an easy way to do it in Django?

Upvotes: 0

Views: 1781

Answers (1)

Nick
Nick

Reputation: 8329

Two ideas come to mind:

  1. Override the predefined model method for saving.
  2. Use a signal like post_save.

Here is a good article that talks about the difference between the two things listed above and when to use them:

Django signals vs. custom save()-method

The article was written near the end of 2007, three days after the release of Django 0.96.1. However, I believe the advice the author gives still applies today.

Upvotes: 4

Related Questions