Hi,

I'm trying to set up primary keys for the table 'ratings' described as :

db.define_table('users',
        Field('name'),
        Field('email'),
        Field('imdb_id', 'integer')
        )

db.define_table('movies',
        Field('imdb_id', 'integer')
        )

db.define_table('ratings',
        Field('iuser', db.users, requires =
IS_IN_DB(db,'users.id',db.users._format)),
        Field('imovie', db.movies, requires =
IS_IN_DB(db,'movies.id',db.movies._format)),
        Field('rating', 'double'),
        primarykey=['iuser', 'imovie'],
        )

Reading the web2py book I saw:
http://web2py.com/books/default/chapter/29/6#Legacy-databases-and-keyed-tables

Referenceing fields must use the reference tablename.fieldname format.

But what does it mean? I tried many combinations like :
['iuser.id', 'imovie.id']
['users', 'movies']
['users.id', 'movies.id']

But none of them work. I end up with two errors: The first one states
that i should use fields defined in the ratings table and the second one
is that the given string cannot be splitted at the dot.

What am i doing wrong?
-- 
Vincenzo Ampolo
http://vincenzo-ampolo.net
http://goshawknest.wordpress.com

Reply via email to