

def delete_instance(self, recursive=False, delete_nullable=False):
    if recursive:
        dependencies = self.dependencies(delete_nullable)
        for (query, fk) in reversed(list(dependencies)):
            model = fk.model_class
            if (fk.null and (not delete_nullable)):
                model.update(**{
                    fk.name: None,
                }).where(query).execute()
            else:
                model.delete().where(query).execute()
    return self.delete().where(self._pk_expr()).execute()

dataset/ETHPy150Open coleifer/peewee/peewee.py Model.delete_instance/original