3 回答
TA贡献1873条经验 获得超9个赞
class cdn_vendor( db.Model ): __tablename__='cdn_site' sno = db.Column( db.Integer, primary_key=True ) vendor_name = db.Column( db.String(100) ) vendors = db.relationship("cdn_vendor_ip",backref=backref("vendor",uselist=False)) class cdn_vendor_ip( db.Model ) __tablename__='cdn_vendor_ip' sno_vendor = db.Column( db.Integer,db.ForeignKey('cdn_vendor.sno') ) ip_addr = db.Column( db.String(20),primary_key=True ) ip_comment = db.Column( db.String(200) )这两个表,不知道我写的关联对不对,需要cdn_vendor 这个表 join 到cdn_vendor_ip这个表,on cdn_vendor.sno=cdn_vendor_ip.sno_vendor
TA贡献1816条经验 获得超4个赞
typedef void(*func)(void);
typedef struct hand
{
char *pname;
func handler;
}HAND_TO;
TA贡献1829条经验 获得超6个赞
视图函数中传递若干个form实例到html页:
12345 | @app .route( '/test/' ) def test(): form1 = TestForm1() form2 = TestForm2() return remder_template( 'test.html' ,form1 = form1,form2 = form2) |
123456789 | < form action = "/test1/ method=" post"> {{ form1.field() }} < input type = "submit" value = "提交" /> </ form > < form action = "/test2/ method=" post"> {{ form2.field() }} < input type = "submit" value = "提交" /> </ form > |
再编写两个视图函数分别接收form1,form2提交的数据:
1234567 | @app .route( '/test1/' , method = [ 'POST' ]) def test1(): # 处理代码 @app .route( '/test2/' , method = [ 'POST' ]) def test2(): # 处理代码 |
- 3 回答
- 0 关注
- 1258 浏览
添加回答
举报