try with :
db.auth_user.requires = IS_IN_DB(db, 'account_type.*id*')

On Tue, Aug 21, 2012 at 11:01 AM, Rujaun Fourie <[email protected]>wrote:

> Hey guys! I have added a extra field in auth_user named "account_type" now
> I want that field to reference a table in the db called "account_type" and
> display the contents of that field in the registration as a dropdown. Here
> is what I did so far:
>
> db = DAL('mysql://*******:********@localhost/lion')
>
> from gluon.tools import Auth, Crud
>
> db.define_table('account_type',
>     Field('type')
> )
>
> auth = Auth(db)
> auth.settings.extra_fields['auth_user'] = [
>     Field('account_type', db.account_type)]
> auth.define_tables(username=True)
>
>
> db.auth_user.requires = IS_IN_DB(db, 'account_type.type')
>


> It gives an error:
> <class 'gluon.contrib.pymysql.err.InternalError'> (1005, u"Can't create
> table 'lion.#sql-678_42' (errno: 150)")
>
> I'm coming from a asp.net MVC and PHP background so this all is still
> quite new to me.
> Regards
> Rujaun
>
> --
>
>
>
>

-- 



Reply via email to