I find my problem. I double define auth.define_tables. once in db.py and second in my_tables.py. Only once definition can be declared.
Le dimanche 7 septembre 2014 18:14:27 UTC+2, olivier hubert a écrit : > > I Massimo, thanks for your quick response. > Could you confirm the extra fields are normally showed in profile page > after a successful registration or I need to create a custom view to do > that? > > This is the new code for my_tables.py modele > > # -*- coding: utf-8 -*- > #Add authentication to the app. > from gluon.tools import Auth > > auth = Auth(db) > > #Add some fields in auth_user table to have a complete user profile. > auth.settings.extra_fields['auth_user']= [ > Field('phone_number', 'string', writable = True, readable = True), > Field('address', 'text', writable = True, readable = True), > Field('city', 'string', writable = True, readable = True), > Field('zip', 'string', writable = True, readable = True), > Field('phone', 'string', writable = True, readable = True), > Field('birthday', 'date', requires = IS_DATE(format=('%d-%m-%Y')), > writable = True, readable = True)] > auth.define_tables(username=True, signature=True) > > Le dimanche 7 septembre 2014 17:42:59 UTC+2, Massimo Di Pierro a écrit : >> >> I cannot reproduce the problem. >> >> Mind that you do not need >> >> auth = Auth(db, hmac_key=Auth.get_or_create_key()) >> >> should be >> >> auth = Auth(db) >> >> >> >> On Sunday, 7 September 2014 07:54:27 UTC-5, olivier hubert wrote: >>> >>> I use the web2py version 2.9.8. >>> I create a simple new app "test_auth" >>> >>> In Models I add "my_tables.py" with the contents below. >>> >>> # -*- coding: utf-8 -*- >>> >>> #Add authentication to the app. >>> from gluon.tools import Auth >>> >>> auth = Auth(db, hmac_key=Auth.get_or_create_key()) >>> >>> >>> *#Add some fields in auth_user table to have a complete user >>> profile.*auth.settings.extra_fields['auth_user']= [ >>> Field >>> <http://127.0.0.1:8000/examples/global/vars/Field>('phone_number', >>> 'string'), >>> Field <http://127.0.0.1:8000/examples/global/vars/Field>('address', >>> 'text'), >>> Field <http://127.0.0.1:8000/examples/global/vars/Field>('city', >>> 'string'), >>> Field <http://127.0.0.1:8000/examples/global/vars/Field>('zip', >>> 'string'), >>> Field <http://127.0.0.1:8000/examples/global/vars/Field>('phone', >>> 'string'), >>> Field <http://127.0.0.1:8000/examples/global/vars/Field>('birthday', >>> 'date', requires = IS_DATE >>> <http://127.0.0.1:8000/examples/global/vars/IS_DATE>(format=('%d-%m-%Y')))] >>> auth.define_tables(username=True, signature=True) >>> >>> I open the page http://127.0.0.1:8000/test_auth/default/user/register >>> >>> The form doesn't show my extra field. >>> >>> After a successful user registration, I open the db admin to see the record >>> in the table "auth_user", but I can't see my extra fields. >>> >>> I already try session cleanup, free cookies, create a new app, ... see and >>> try some tricks from this forum or stack overflow. I probably miss >>> something but I can't see what. >>> >>> -- 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.