db.define_table('newname',*[f for f in db.table])

On Jan 28, 2:20 pm, Thadeus Burgess <thade...@thadeusb.com> wrote:
> Is there a way to iterate through the Field() elements of a table and
> use them to create another similar table ?
>
> I'm looking for something like
>
> db.define_table('hi', Field('hello'), Field('world'))
>
> class Foo()
>    def init(atable):
>       for field in atable:
>          db.define_table(tablename + '_mod', field, field, field,
> Field('bar', 'datetime'))
>
> So I would end up with
>
> db.hi and db.hi_mod.
>
> -Thadeus

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.

Reply via email to