Add Subdepartment.products relationship.

For the sake of clearing FK's when deleting a subdepartment.
This commit is contained in:
Lance Edgar 2016-02-07 21:36:12 -06:00
parent 4d7f7adae4
commit e46803dfbc

View file

@ -174,7 +174,11 @@ UTC timestamp of the product's last sale event.
""") """)
department = orm.relationship(Department, order_by=Department.name) department = orm.relationship(Department, order_by=Department.name)
subdepartment = orm.relationship(Subdepartment, order_by=Subdepartment.name)
subdepartment = orm.relationship(
Subdepartment,
order_by=Subdepartment.name,
backref=orm.backref('products', cascade='all'))
category = orm.relationship( category = orm.relationship(
Category, back_populates='products') Category, back_populates='products')