pydal

How to create instance of a table entry but not added in ponyorm?

筅森魡賤 提交于 2019-12-13 03:29:58
问题 How can I use a create an instance of a table definition without inserting a row to the corresponding Table. For example what I would like is: from pony import orm from pony.orm import Required db = orm.Database() class User(db.Entity): name = Required(str) address = Optional(str) db.bind(provider='sqlite', filename=':memory:') db.generate_mapping(create_tables=True) bob = User(name='bob') ### CODE FROM HERE ON IS WRONG BUT SHOWCASES WHAT I WANT # So far the database has not been modified bob

rendering foreign keys as a pulldown in web2py appadmin

六眼飞鱼酱① 提交于 2019-12-12 03:42:22
问题 part of my web2py database schema looks like so: db.define_table('asset', Field('name', unique=True, requires=IS_NOT_EMPTY()), Field('description', 'text') ) db.define_table('wallet', Field('name', unique=True, requires=IS_NOT_EMPTY()), Field('description', type='text') ) db.define_table('wallet_asset', Field('wallet_id', 'reference wallet'), Field('asset_id', 'reference asset') ) When I visit appadmin to enter a new wallet_asset record, I would like for the wallet_id and asset_id fields to