What do you mean by first extending auth ... Before referencing it... if i 
do so then i get an atrribute error.

See here a snippet of my code which works in this order but auth.signature 
( because i reference to auth.signature before i define my auth tables?
 )

--------------------------------------------------
from gluon.tools import Auth, Service, PluginManager

auth = Auth(db)
service = Service()
plugins = PluginManager()

## adding custom fields to Auth_user table
db.define_table('work_position',
                Field('Name',requires=IS_NOT_EMPTY(error_message='cannot be 
empty!'), label=T('Name')),
                format='%(Name)s')

db.define_table('practice',
                Field('Name',requires=IS_NOT_EMPTY(error_message='cannot be 
empty!'), label=T('Name')),
                format='%(Name)s')

auth.settings.extra_fields['auth_user']= [
                Field('work_position', db.work_position, 
label=T('Profession')),
                Field('practice', db.practice, label=T('Practice')),
                
Field('Reg_number',requires=IS_NOT_EMPTY(error_message='cannot be empty!'), 
label=T('Registration Number')),]

## create all tables needed by auth if not custom tables
auth.define_tables(username=False, signature=False)

## configure auth policy
auth.settings.registration_requires_verification = False
auth.settings.registration_requires_approval = False
auth.settings.reset_password_requires_verification = True
auth.settings.actions_disabled=['register']

Op woensdag 1 juni 2016 16:06:10 UTC+2 schreef Niphlod:
>
> at a minimum you need to extend auth BEFORE referencing it. and where is 
> your auth.define_tables() call ?
>
> On Wednesday, June 1, 2016 at 3:00:50 PM UTC+2, Steve wrote:
>>
>> Hi,
>>
>> I am trying to extend the Auth_user tabel with a dropdown field.
>>
>> I have them working but if i try to add the "Auth.signature" in Db.py to 
>> the table "work_position"  i get an error message. 
>> error message: 
>> <type 'exceptions.KeyError'> 'Cannot resolve reference auth_user in 
>> work_position definition'
>>
>>
>>
>> -----------------------------------------------------------------------------
>> from gluon.tools import Auth, Service, PluginManager
>>
>> auth = Auth(db)
>> service = Service()
>> plugins = PluginManager()
>>
>> ## adding custom fields to Auth_user table
>> db.define_table('work_position',
>>                 Field('Name',requires=IS_NOT_EMPTY(error_message='cannot 
>> be empty!'), label=T('Name')),
>>                 auth.signature,
>>                 format='%(Name)s')
>>
>> auth.settings.extra_fields['auth_user']= [
>>                 Field('work_position', db.work_position, 
>> label=T('Profession')),
>>                 etc
>>
>> Anyone an idea to solve this ?
>> Without the auth.signature it works fine.
>>
>> steve
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to