[web2py] Re: auth.settings.extra_fields problem

2015-08-14 Thread 黄祥
if you put define table separtely (into more than 1 file), models file is load base on file name ordered. so let say you have db_wizard_1.py that define table department (generate first) db_wizard_2.py that define table auth_tables in case you put all the define tables into 1 file such as db.py

[web2py] Re: auth.settings.extra_fields problem

2015-08-14 Thread Paolo Amboni
It's true!!! The table is in another model file. I moved before the declaration and all works!!! Which is the order web2py use to load models file? Il giorno venerdì 14 agosto 2015 12:12:04 UTC+2, 黄祥 ha scritto: > > not sure without seeing the full code, but i guess you are not define > table de

[web2py] Re: auth.settings.extra_fields problem

2015-08-14 Thread 黄祥
not sure without seeing the full code, but i guess you are not define table department before define auth tables. best regards, stifan On Friday, August 14, 2015 at 4:46:45 PM UTC+7, Paolo Amboni wrote: > > This don't work: > auth.settings.extra_fields['auth_user']= [ Field('id_dep','reference

[web2py] Re: auth.settings.extra_fields - do not show on registration?

2013-04-22 Thread Niphlod
you have to do it checking request.args(0) in the function that provides auth() usually it's the def user() inside default.py something like def user(): if request.args(0) == 'register': db.table.field.writable = db.table.field.readable = False . return dict

[web2py] Re: auth.settings.extra_fields

2013-04-08 Thread Domagoj Kovač
I added companies definition in db.py. It will be ok for now. Thanks. On Monday, April 8, 2013 11:05:22 AM UTC+2, Domagoj Kovač wrote: > > Is there any way to load models manually? > > On Monday, April 8, 2013 10:23:55 AM UTC+2, Niphlod wrote: >> >> uhm. if you want that field to be a reference t

[web2py] Re: auth.settings.extra_fields

2013-04-08 Thread Domagoj Kovač
Is there any way to load models manually? On Monday, April 8, 2013 10:23:55 AM UTC+2, Niphlod wrote: > > uhm. if you want that field to be a reference to the values on the table, > the table must be defined, so I don't see how a SQLFORM.factory could help > you with that. > You simply have a co

[web2py] Re: auth.settings.extra_fields

2013-04-08 Thread Niphlod
uhm. if you want that field to be a reference to the values on the table, the table must be defined, so I don't see how a SQLFORM.factory could help you with that. You simply have a conditional model that for your app logic doesn't need to be conditional . On Monday, April 8, 2013 10:20:56 AM U

[web2py] Re: auth.settings.extra_fields

2013-04-08 Thread Domagoj Kovač
I see it now. Thanks man! I have a different problem now, now i don't get any errors immediately but when i go on users/create i get an error saying: 'DAL' object has no attribute 'companies' obviously companies model is not loaded, i am thinking on switching to SQLform.factory, would this be a

[web2py] Re: auth.settings.extra_fields

2013-04-08 Thread Niphlod
too many db. requires=IS_IN_DB(db, (db, 'companies.id', '%(name)s')) needs to be requires=IS_IN_DB(db, 'companies.id', '%(name)s') On Monday, April 8, 2013 9:39:15 AM UTC+2, Domagoj Kovač wrote: > > Hi, > > i tried moving companies outside of db.py. > > In db.py i have: > > auth.setting

[web2py] Re: auth.settings.extra_fields

2013-04-08 Thread Domagoj Kovač
Hi, i tried moving companies outside of db.py. In db.py i have: auth.settings.extra_fields['auth_user'] = [Field('deleted', 'boolean', default=False), Field('company_id', 'reference companies', requires=IS_IN_DB(db, (db, 'companies.id', '%(name)s')))

[web2py] Re: auth.settings.extra_fields

2013-04-05 Thread Anthony
Note, simply doing (db, 'companies.id', ...) may not completely resolve the problem. Even doing that, the db.companies table is only getting defined conditionally when the "companies" controller is called, but the db.auth_user table is defined on every request, and it could be used by other con

[web2py] Re: auth.settings.extra_fields

2013-04-05 Thread Domagoj Kovač
Thanks man! On Friday, April 5, 2013 5:30:38 PM UTC+2, Niphlod wrote: > > Nope. > when "auth" definition is encountered, if you want to use > db.companies.idwritten as it is, db.define_table('companies') should have > been executead > already. > You need to change your IS_IN_DB call to (db, 'co

[web2py] Re: auth.settings.extra_fields

2013-04-05 Thread Niphlod
Nope. when "auth" definition is encountered, if you want to use db.companies.id written as it is, db.define_table('companies') should have been executead already. You need to change your IS_IN_DB call to (db, 'companies.id', '%(name)s') ... notice the ticks around companies.id, it's a string

[web2py] Re: auth.settings.extra_fields

2013-04-05 Thread Domagoj Kovač
Thanks guys, right now my db.py looks like this: from gluon.tools import Auth, Crud, Service, PluginManager, prettydate auth = Auth(db) crud, service, plugins = Crud(db), Service(), PluginManager() db.define_table('companies', Field('name', 'string', require

[web2py] Re: auth.settings.extra_fields

2013-04-05 Thread Niphlod
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

[web2py] Re: auth.settings.extra_fields

2013-04-05 Thread ctrlSoft
models are executed in alphabetical order. db.py and after that companies.py, you make reference to a non define table. you sould define companies table right after auth = Auth(db) and before auth.settings. extra_fields['auth_user'] = auth = Auth(db) # # # # db.define_table('compa

[web2py] Re: auth.settings.extra_fields['auth_user']

2013-04-04 Thread Domagoj Kovač
Thanks guys, i solved it other way. On Thursday, April 4, 2013 3:17:49 AM UTC+2, 黄祥 wrote: > > please try this in your db.py: > > db.define_table('company', > Field('company_name'), > Field('website'), > format='%(company_name)s') > > auth.settings.extra_fields['auth_user']=[ > Fie

[web2py] Re: auth.settings.extra_fields['auth_user']

2013-04-03 Thread 黄祥
please try this in your db.py: db.define_table('company', Field('company_name'), Field('website'), format='%(company_name)s') auth.settings.extra_fields['auth_user']=[ Field('gender', 'list:string'), Field('address', 'text'), Field('zip'), Field('city'), Field('cou

[web2py] Re: auth.settings.extra_fields['auth_user']

2013-04-03 Thread Massimo Di Pierro
What error message do you expect? On Wednesday, 3 April 2013 09:44:59 UTC-5, Domagoj Kovač wrote: > > Hi folks, > > i have a problem. I am using form widget i am trying to customize > registration form. I my model i added > > auth.settings.extra_fields['auth_user'] = [Field('company_id', > 'str