From 93d026d2ac527b8b54b0bd80a9d6a98ffcacd848 Mon Sep 17 00:00:00 2001 From: Arthur ZHU Date: Thu, 23 Dec 2021 23:19:31 +0100 Subject: [PATCH] cascade sur les offres et les contacts --- app/entreprises/models.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/entreprises/models.py b/app/entreprises/models.py index a079cacf..a04d115b 100644 --- a/app/entreprises/models.py +++ b/app/entreprises/models.py @@ -9,8 +9,8 @@ class Entreprise(db.Model): codepostal = db.Column(db.Text) ville = db.Column(db.Text) pays = db.Column(db.Text) - contacts = db.relationship('EntrepriseContact', backref='entreprise', lazy='dynamic') - offres = db.relationship('EntrepriseOffre', backref='entreprise', lazy='dynamic') + contacts = db.relationship('EntrepriseContact', backref='entreprise', lazy='dynamic', cascade="all, delete-orphan") + offres = db.relationship('EntrepriseOffre', backref='entreprise', lazy='dynamic', cascade="all, delete-orphan") class EntrepriseContact(db.Model): __tablename__ = "entreprise_contact"