November 2014
Intermediate to advanced
258 pages
5h 15m
English
First, let's build a form using a SQLAlchemy model. We will take the product model from our catalog application and add the functionality to create products from the frontend using a webform.
We will use our catalog application from Chapter 4, Working with Views. We will develop a form for the Product model.
To remind you, the Product model looks like the following lines of code in the models.py file:
class Product(db.Model): id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String(255)) price = db.Column(db.Float) category_id = db.Column(db.Integer, db.ForeignKey('category.id')) category = db.relationship( 'Category', backref=db.backref('products', lazy='dynamic') ...Read now
Unlock full access