I have prototyped a change to the way smartgrid processes linked_tables. I
would like a similar change in the distributed code.
In current stable version, if linked_tables is a dictionary, smartgrid uses
the keys but throws the values away. I propose the following:
If linked_tables is not a dictionary, do as before.
If linked_tables is a dictionary, the values can be one field name or a
list of field names.
If one field name, append to links same as table/field entries now work.
If a list, iterate over the list and append each.
If empty list, ignores the entry.
I have a working prototype with a little work to be done so it raises an
exception if a field name is incorrect.
I will open a ticket and attach a diff once I have the error handling
working. The code will be verbose and repetitive; I will keep working on
that, but I want to get the concept in front of you.
Thanks,
Cliff Kachinske
On Sunday, March 31, 2013 7:35:26 PM UTC-4, Massimo Di Pierro wrote:
>
> Please add a ticket about this. I am not sure it is a bug but if it is
> track I will check it asap.
>
> On Friday, 29 March 2013 14:59:58 UTC-5, Cliff Kachinske wrote:
>>
>> Massimo,
>>
>> I tried setting them that way in the controller but it didn't help.
>>
>> On Friday, March 29, 2013 12:12:30 PM UTC-4, Massimo Di Pierro wrote:
>>>
>>> Have you tried making the fields that you do not want readable=False?
>>>
>>> On Friday, 29 March 2013 09:17:50 UTC-5, Cliff Kachinske wrote:
>>>>
>>>> There is a table something like this:
>>>>
>>>> db.define_table('example',
>>>> ...
>>>> field('user_id', 'reference auth_user', requires=IS_IN_DB(.....)),
>>>> field('created_by', 'reference auth_user', requires=IS_IN_DB(.....)),
>>>> field('modified_by', 'reference auth_user',
>>>> requires=IS_IN_DB(.....)),
>>>> ...
>>>> )
>>>>
>>>> Then I do something like
>>>>
>>>> form = SQLFORM.smartgrid(db.auth_user, linked_tables=['example' ...],
>>>> fields=[db.example.user_id, ...] ...)
>>>>
>>>> smartgrid gives me three links to the example table: example.user_id,
>>>> example.created_by, example.modified_by
>>>>
>>>>
>>>> How can I suppress the example.created_by and example.modified_by
>>>> links? I thought the entry in fields would do it, but it does not.
>>>>
>>>> Thanks for any help on this.
>>>>
>>>
--
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.