class TransactionProducts(db.Model): id = db.Column(db.Integer, primary_key=True, autoincrement=True) transaction_id = db.Column(db.Integer, db.ForeignKey("transactions.id"), nullable=False) product_id = db.Column(db.Integer, db.ForeignKey("products.id"), nullable=False) product_qty = db.Column(db.Integer, nullable=False) transaction = relationship("Transactions", backref="transaction_products") product = relationship("Products", backref="transaction_products")
class TransactionProducts(db.Model): id = db.Column(db.Integer, primary_key=True, autoincrement=True) transaction_id = db.Column(db.Integer, db.ForeignKey("transactions.customer_transaction_id"), nullable=False) product_id = db.Column(db.Integer, db.ForeignKey("products.id"), nullable=False) product_qty = db.Column(db.Integer, nullable=False) transaction = relationship("Transactions", backref="transaction_products") #transaction = relationship("Transactions") #product = relationship("Products", backref="transaction_products") product = relationship("Products") event_time = db.Column(db.DateTime, nullable=False) def __init__(self): self.event_time = datetime.now()