[web2py] Re: Getting table a to use as default string from field in table b

2011-12-12 Thread tsvim
Ok here's what I want to do. I want a user to be able to create multiple tables of data, with some information about every table. So instead of creating more tables, I figured I'll have one big table of data with a reference to the record in the table_settings database so I can return to the

[web2py] Re: Getting table a to use as default string from field in table b

2011-12-12 Thread Anthony
Still, if I understand correctly I'd have to setup a AJAX call requesting the default values to prepopulate the fields with the defaults matching the table? Or else maybe when creating the table for the user, I could enter the default values. I'm trying to imagine though how I would go

[web2py] Re: Getting table a to use as default string from field in table b

2011-12-11 Thread tsvim
Obviously you're right. I realized later that I needed to re-think what I was trying to do. The id of current user is stored in the data table. Is there a way I can refernce that field in the line you gaveme? Thanks for all your help.

[web2py] Re: Getting table a to use as default string from field in table b

2011-12-11 Thread Anthony
Sorry, not sure exactly what you mean? Can you provide more detail -- maybe show some code? On Sunday, December 11, 2011 1:35:35 PM UTC-5, tsvim wrote: Obviously you're right. I realized later that I needed to re-think what I was trying to do. The id of current user is stored in the data

[web2py] Re: Getting table a to use as default string from field in table b

2011-12-11 Thread tsvim
db.define_table('table_settings', Field('name','string'), Field('default_value','string')) db.define_table('data', Field('parent_table',db.table_settings,writable=False,readable=False),

[web2py] Re: Getting table a to use as default string from field in table b

2011-12-11 Thread ニコノコ
SOrry, email editor mangled the text. SHould read: db.table_settings['parent_table'].default_value.default On Dec 12, 12:21 pm, Nik Go nikolai...@gmail.com wrote: db.table_settings.default_value.requires = IS_IN_SET(['a','b']) db.table_settings['parent_table'].default_value*.default* I think

[web2py] Re: Getting table a to use as default string from field in table b

2011-12-11 Thread Anthony
On Sunday, December 11, 2011 1:53:11 PM UTC-5, tsvim wrote: db.define_table('table_settings', Field('name','string'), Field('default_value','string')) db.define_table('data',

[web2py] Re: Getting table a to use as default string from field in table b

2011-12-10 Thread Anthony
Assuming you have the record id of the current user from the 'user_table' table, maybe something like: Field('x', default=db.user_table[id of current user].default_x) You cannot just refer to the field (which doesn't identify the specific user) -- you have to select the specific value for