OK, the following may be my own mistake (I changed a normal table to the 
one with composite key without changing rest of the code)

Now, next question : via appadmin, how can I edit a record from a table 
with contains the composite key ?
Normally, user would click on "id" shown in the table which points to the 
url of the form appadmin/update/db/<tablename>/<id>

Since a table with composite key does NOT key "id" - there doesn't seem to 
obvious way to edit such a record.
(As listed below, both the fields are foreign keys and are thus hyperlinks. 
Clicking on either user or skill takes user to edit that user or skill)

Is there a non-obvious way ?

-Mandar

On Thursday, August 16, 2012 5:53:15 PM UTC+5:30, Mandar Vaze wrote:
>
> I've an associate table for many-to-many relationship with composite 
> key defined as follows :
>
> db.define_table('user_skill', 
>     Field('user', db.user), 
>     Field('skill', db.skill),
>     primarykey=['user', 'skill'])
>
> When I use SQLFORM.grid for the above table, I get the following error :
>
>   File "/home/mandar/web2py/gluon/sqlhtml.py", line 1596, in grid
>     field_id = tables[0]._id
>   File "/home/mandar/web2py/gluon/dal.py", line 7357, in __getattr__
>     return self[key]
>   File "/home/mandar/web2py/gluon/dal.py", line 7297, in __getitem__
>     return dict.__getitem__(self, str(key))
> KeyError: '_id'
>
> SQLFORM.grid seems to be looking explicitly for 'id' field hence the error.
>
> Is there a workaround ?
>
> Thanks,
> -Mandar
>
>

-- 



Reply via email to