title: Check if Django model is getting saved or deleted inside the model's init method
body: <p>How can I check inside a Django model's <strong>init</strong> method, whether the object is about to get saved or deleted. I'd like to do some stuff <em>only</em> before the save or deleted method gets called.</p>
  
  <pre><code>class Book(models.Model):
      title = models.CharField(max_length=150)
      def __init__(self, *args, **kwargs):
          super(Book, self).__init__(*args, **kwargs)
          if self.is_about_to_get_saved_or_deleted:
              do_something()
  </code></pre>
  
  <p>To say a few words about the <em>why</em>:</p>
  
  <p>I need to implement live Elasticsearch search index updates. Therefore, I need to check whether certain model field values are changes or if an object gets deleted. Delete is not a problem. However, to see if field values have changed inside the save method, I need to store a heap of values inside the init method first:</p>
  
  <p><a href="https://stackoverflow.com/a/1793323/996638">https://stackoverflow.com/a/1793323/996638</a></p>
  
  <p>But the init method also gets called when merely <em>reading</em> an object. In order to prevent the overhead, I'd like to store the relevant (old) field values only if the object is about to get saved. This would require only one IF statement as overhead.</p>