title: Django: disable binary logs for delete() method
body: <p>I have a MySQL master-slave configuration and I want to delete some old records on master only and keep them on slave:</p>
  
  <pre><code>class MonitorQuerySet(models.QuerySet):
      def delete(self, *args, **kwargs):
          with connection.cursor() as cur:
              cur.execute('SET @@session.sql_log_bin = 0')
              ret = super().delete(*args, **kwargs)
              cur.execute('SET @@session.sql_log_bin = 1')
          return ret
  
  class Monitor(models.Model):
  ...
      objects = models.Manager()
      nobinlog = MonitorQuerySet.as_manager()
  </code></pre>
  
  <p>The problem with this approach is that now one can do <code>Monitor.nobinlog.delete()</code> and this will wipe out the whole table.</p>
  
  <p>I though about <code>pre_delete</code> and <code>post_delete</code> signals but that will run on each call to <code>delete()</code>.</p>
  
  <p>Is there a better solution for this?</p>