我用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)
我的问题是如何(使用formalchemy)生成包含Product字段的表单,还有已创建的ProductPackageTypePrice和字段来添加新表单?