title: How to access to database objects in django custom save method?
body: <p>I have to check if the django model save method is for create new object or update it, because i have to update status of the child objects from parent if is updated.</p>
  
  <pre><code>class Categoria(Entidad):
  
    ESTADO = (("Activo", "Activo"), ("Inactivo", "Inactivo"))
    estado = models.CharField(verbose_name=_("Estado"), max_length=20, choices=ESTADO, default=1)
    categoria_padre = models.ForeignKey('self', verbose_name=_("Categoría Padre"), related_name='parent_category', related_query_name='child_category', null=True, blank=True, on_delete=models.CASCADE)
  
    def save(self, *args, **kwargs):
  
      from django.db import connection
  
      # first option does not work because i can access to django model manager
      old = self.objects.get(id=self.id)
  
      # second option throughs 500 error when create new objects
      cursor = connection.cursor()
      response = cursor.execute("SELECT * FROM cms_categoria WHERE id = '" + str(self.id) + "'")
      set = response.fetchall()
      connection.commit()
      cursor.close()
      connection.close()
  </code></pre>
  
  <p>The second options works on local development but not when push it to heroku with postgres.</p>
  
  <p>Anybody could help me please ?
  Thanks, Regards.</p>