All pastes #2050826 Raw Edit

Someone

public text v1 · immutable
#2050826 ·published 2011-04-26 11:39 UTC
rendered paste body
# A Product can belong to a ProductGroup but each ProductGroup can
# have a representative main reference product along with the list of
# product group members.

class Product(DeclarativeBase):
    ...
    productgroup_id = Column(Integer, ForeignKey('productgroup.id'))
    productgroup = relation('ProductGroup', backref='products')
    ...

class ProductGroup(DeclarativeBase):
    ...
    reference_product_id = Column(Integer, ForeignKey('product.id'))
    reference_product = relation('Product')
    ...