Formalchemy - form for one to many relation

261 views Asked by At

I've got simple 'one-to-many' relation written with sqlalchemy:

class Product(Base, Asset):
    description         = Column(sa.Text)
    image               = Column(sa.VARCHAR(length=150))
    package_type_prices = relationship("ProductPackageTypePrice")

class ProductPackageTypePrice(Base, Asset):
    id           = Column(sa.Integer, primary_key=True, nullable=False)
    id_product   = Column(sa.Integer, ForeignKey("assets.product.id"))
    package_type = Column(package_type_enum, nullable=False)
    price        = Column(sa.DECIMAL(10,2), nullable=False)

My question is how to (using formalchemy) generate form with fields for Product but also for already created ProductPackageTypePrice's and fields to add new one?

0

There are 0 answers