three things
1) user is not a valid field name because it is a reserved keyword in
sql
2) in Field('user',custom_auth_table, custom_auth_table should be a
table (as in db.tablename) and not a field.
3) in db.product.user.default = custom_auth_table.first_name you are
setting a default value (left) to a field (right) instead of a field
value.
After you fix 1,2, you should move 3 into the action that needs it and
replace the right-hand side with the proper value.
On Sep 14, 2:03 pm, Andrew Evans <[email protected]> wrote:
> I have a custom auth table
>
> I set a variable to something like this: custom_auth_table =
> db[auth.settings.table_user_name] # get the custom_auth_table
>
> I then define a product table
>
> db.define_table('product',
> Field('product_name',length=512),
> Field('user',custom_auth_table, readable=False, writable=False),
>
> custom_auth_table is set to the user field in there
>
> I then set user fields default value to first_name from the auth table
>
> db.product.user.default = custom_auth_table.first_name
>
> But when I try to add a product to the product db from my SQLForm I get an
> error message. Any idea what could be wrong?
>
> *cheers