Hi Alan,

Thank you for your work on the json data type. (Sorry for getting your name 
wrong in my other post). These discussions are great for thinking through 
my problem.

Yes I would need to post json data into the database and also search the 
data, display and edit it also. My app is just one tool in a design 
department storing design data for import/export to EDA sofware and test 
lab benches. An 'attributes' table holds different design parameters of 
designs and models. 

For me, a 'json:reference attributes' field would basically be like a 
"list: string" field but with only one string holding a json object of 
a variable list of attributes with their value and unit. The actual 
attributes table simply holds a list of available parameters (with default 
values, types, usage and unit) users can select from to build their 
parameter list. Kind of like a one to many relationship except there is no 
reference to other tables and the list can vary. Perhaps the word reference 
is not quite right then but I was reaching for some way 
to succinctly describe it.

So the enhancement would:
use a select widget for the referenced table used in 
creating/adding/removing "Rows" of values
have the ability to assign a grid object for viewing rows where the column 
names match the fields in the referenced table
perhaps a widget should instead behave like the web2py app wizard where 
another row of blank text fields can be added to edit your values 
-- a drop down would have to be used in place of a select widget with 
editable=referenced_table[field].writable and 
visible=referenced_table[field].readable
match json data types to widgets where multiple always = True.
with json stored as a string then searching should be easy.

This is only my vision so someone else may have a different view of a 
'json:reference my_other_table' usage. 

-Bill










On Sunday, January 20, 2013 12:54:00 PM UTC-6, Alan Etkin wrote:
>
> would a 'json:reference mytable' field type similar to 'list:reference 
>> mytable' or perhaps a format=lambda row: row.json() be possible? 
>>
>
> What would be the enhancement required specifically?
>
> Do you need to PUT/POST json data into a DAL database with a service?
>
> If you need to return the table structure, you can do something like:
>
> table = dict()
> for f in db.<tablename>:
>     if isinstance(f.requires, list):
>         requires = [type(r) for r in f.requires]
>     else:
>         requires = [type(f.requires),]
>     table[f.name] = {"default": f.default, "type": f.type, "requires":requires
> }
>
> If you return the table object in the controller, the generic json handler 
> should serialize it automatically. Something similar could be implemented 
> for validation of forms
>
>

-- 



Reply via email to