def delete(self):
        self._run_callbacks('before_delete')

        try:
            id_ = getattr(self.fields, 'id')
            result = r.table(self._table).get(id_).delete().run()
        except __HOLE__:
            raise OperationError('Cannot delete %r (object not saved or '
                                 'already deleted)' % self)

        if result['errors'] > 0:
            raise OperationError(result['first_error'])

        delattr(self.fields, 'id')
        # Remove any reference to the deleted object
        for field in self.fields.related:
            delattr(self.fields, field)

        self._run_callbacks('after_delete')

    # TODO: Get rid of this nasty decorator after renaming .get() on ObjectHandler
dataset/ETHPy150Open linkyndy/remodel/remodel/models.py/Model.delete