the point is having that "db.companies.id" evaluated later .
you can pass a string to the is_in_db validator, it shouldn't raise the
error
IS_IN_DB(db, 'companies.id', '%(name)s')
*should* work giving you a nice dropdown too.
On Friday, April 5, 2013 4:48:33 PM UTC+2, ctrlSoft wrote:
>
> models are executed in alphabetical order. db.py and after that
> companies.py, you make reference to a non defined table. you sould define
> companies table before auth.settings.extra_fields['auth_user'] =
> auth = Auth(db)
> #....
> #....
> #....
> #....
> db.define_table('companies',
> Field('name', 'string',
> required=True,
> requires=IS_NOT_EMPTY(),
> label=LABEL(T("Naziv"), _for="companies_name")),
> Field('url_sufix', 'string',
> required=True,
> requires=IS_NOT_EMPTY(),
> unique=True,
> label=LABEL(T("Url-sufix"), _for=
> "companies_url_sufix")),
> Field('logo', 'upload',
> label=LABEL(T("Logo"), _for="companies_logo")),
> Field('deleted', 'boolean'))
>
>
> auth.settings.extra_fields['auth_user'] = [Field('deleted', 'boolean',
> default=False),
> Field('company_id', 'reference
> companies', requires=IS_IN_DB(db,db.companies.id))]
>
> in db.py
>
--
---
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.