The code below works for me. Something else is wrong in your code. Perhaps sessions are not being saved?
auth.settings.table_user = db.define_table('auth_user', Field('email',length=128,label=T('Email'),default='',unique=True), Field('password','password',readable=False,label=T('Password'), requires=CRYPT()), Field('first_name',length=128,label=T('First name'),default='', requires=(IS_NOT_EMPTY (error_message=auth.messages.is_empty), IS_NOT_IN_DB(db,'auth_user.first_name'))), Field('last_name',length=128,label=T('Last name'),default='', requires=(IS_NOT_EMPTY (error_message=auth.messages.is_empty), IS_NOT_IN_DB(db,'auth_user.last_name'))), Field('user_name',length=128,label=T('User name'),default='', unique=True,requires=IS_NOT_IN_DB (db,'auth_user.user_name')), Field('registration_key',length=128,default='', writable=False,readable=False), Field('country','string',length=15,label=T('Country'), requires=IS_NULL_OR(IS_IN_SET(('England')))), ) def user(): if request.args(0)=='profile': db.auth_user.first_name.readable = db.auth_user.first_name.writable=False db.auth_user.last_name.readable = db.auth_user.last_name.writable=False pass return dict(form=auth()) {{extend 'layout.html'}} <h2>{{=request.args(0).replace('_',' ').capitalize()}}</h2> {{if request.args(0)=='profile' :}} {{=form.custom.begin}} {{=TABLE( TR(TH(form.custom.label['email']),TD(form.custom.widget.email)), TR(TH(form.custom.label['user_name']),TD (form.custom.widget.user_name)), TR(TH(form.custom.label['country']),TD(form.custom.widget.country)), ) }} {{=INPUT(_type='submit',_name='profile',_value='Save Changes')}} {{=form.custom.end}} {{else:}} {{=form}} {{pass}} On Jan 1, 10:24 pm, weheh <richard_gor...@verizon.net> wrote: > Massimo, > > The last 2 posts look like they're off thread. Back to the custom form > with auth profile: > > # model > auth_table = db.define_table( > auth.settings.table_user_name, > Field('email',length=128,label=T('Email'),default='',unique=True), > Field('password','password',readable=False,label=T('Password'), > requires=CRYPT()), > Field('first_name',length=128,label=T('First name'),default='', > requires=(IS_NOT_EMPTY(error_message=auth.messages.is_empty), > IS_NOT_IN_DB(db,'auth_user.first_name'))), > Field('last_name',length=128,label=T('Last name'),default='', > requires=(IS_NOT_EMPTY(error_message=auth.messages.is_empty), > IS_NOT_IN_DB(db,'auth_user.last_name'))), > Field('user_name',length=128,label=T('User name'),default='', > unique=True,requires=IS_NOT_IN_DB(db,'auth_user.user_name')), > Field('registration_key',length=128,default='', > writable=False,readable=False), > Field('country','string',length=15,label=T('Country'), > requires=IS_NULL_OR(IS_IN_SET(COUNTRIES))), > ) > > auth.settings.table_user = auth_table > > # controller > def user(): > if request.args(0)=='profile': > > db.auth_user.first_name.readable=db.auth_user.first_name.writable=False > > db.auth_user.last_name.readable=db.auth_user.last_name.writable=False > return dict(form=auth()) > > Now, I'm sorry to have to ask for this, but what is wrong with this > view and why won't it work? (I'm transcribing here, so I hope I don't > have any typos) > > #view > > {{extend 'layout.html'}} > {{if request.args(0)=='profile' :}} > {{=form.custom.begin}} > {{=TABLE( > TR(TH(form.custom.label['email']),TD(form.custom.widget.email)), > TR(TH(form.custom.label['user_name']),TD > (form.custom.widget.user_name)), > TR(TH(form.custom.label['country']),TD(form.custom.widget.country)), > )}} > > {{=INPUT(_type='submit',_name='profile',_value='Save Changes')}} > {{=form.custom.end}} > {{pass}} > > Again, pardon if I made any typos. The actual code has no typos and > throws no tickets and is basically the same. Would much appreciate any > help to solve this conundrum. Probably something really simple and > stupid, but I'm not seeing it. > > Also, as an aside, I tried again to get rid of the first and last name > fields, since I don't want them and don't use them, but web2py 1.72.3 > doesn't like that. I thought this had been changed awhile back? -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.