reflex-examples icon indicating copy to clipboard operation
reflex-examples copied to clipboard

How should the table relationship be?

Open ystekno opened this issue 1 year ago • 1 comments

class ProductGroup(pc.Model, table=True):
    code: str = None
    name: str


class Product(pc.Model, table=True):
    code: str = None
    name: str
    price = float
    image: str = None
    description: str = None
    is_active: bool = True
    productgroup: ProductGroup

The Product table is related to the ProductGroup table with a foreign key. The above definition doesn't work!

ystekno avatar Mar 11 '23 05:03 ystekno