This works fine. def after_profile(form): if form.vars.user_type == 'Job_Seeker': redirect(URL('default','edit_profile')) return locals()
def edit_profile(): db.employee.employee_profile.default = auth.user_id record = db(db.employee.employee_profile== auth.user_id).select() form = SQLFORM(db.employee,record[0].id,deletable=True, submit_button='Update Profile').process() return dict(form = form) But I agree with you Anthony. Its probably overkill since I already for the signature. I will also try the other you suggested. You are the best Anthony! On Monday, March 7, 2016 at 8:26:03 AM UTC-5, Anthony wrote: > This doesn't quite make sense. You are processing one form, and in the > callback, you overwrite the "form" variable with an entirely new form > object, attempting to process it immediately without the user having seen > or submitted it. I think you need a different strategy. > > Two other tips: > > - If your callback already has the proper signature, there is no need > to wrap it in a lambda -- just do auth.settings.profile_onaccept = > after_profile. > - If you have the Row object of a record, just pass that as the > "record" argument to SQLFORM -- if you pass the id, SQLFORM will then do > an > additional query to get the Row object. > > Anthony > > On Sunday, March 6, 2016 at 6:59:20 PM UTC-5, Ron Chatterjee wrote: >> >> I have the auth_user split up between employer and employee >> >> After the profile is created I want to be able to modify the employee >> profile. >> >> >> So, I have this in my model >> >> auth.settings.profile_onaccept = lambda form: after_profile(form) >> >> In my controller: >> >> def after_profile(form): >> if form.vars.user_type == 'employee': >> record = db(db.employee.employee_profile== auth.user_id).select() >> form = SQLFORM(db.employee,record[0].id,deletable=True, >> submit_button='Update Profile').process() >> if form.accepted: >> session.flash = T(profile is modified') >> redirect(URL('default','index')) >> else: >> redirect(URL('default','index')) >> return dict(form = form) >> >> request.args(0) is 'profile'. >> >> How to make the SQLFORM to make it editable for that profile/user_id? It >> doesn't work the way it is. >> >> On Friday, February 5, 2016 at 11:58:23 AM UTC-5, Ron Chatterjee wrote: >>> >>> yes got it. Thank you. sorry. lol >>> >>> On Friday, February 5, 2016 at 11:19:29 AM UTC-5, Anthony wrote: >>>> >>>> In the shell, just print it, pass it to str(), or call its .xml() >>>> method. >>>> >>>> Or just load it in the browser and "view source". >>>> >>>> Anthony >>>> >>>> On Friday, February 5, 2016 at 10:44:58 AM UTC-5, Ron Chatterjee wrote: >>>>> >>>>> This may be trivial but how do I get the html code out of >>>>> auth.navbar()? It shows up as a gluon object. >>>>> >>>>> On Tuesday, February 2, 2016 at 6:29:19 PM UTC-5, Anthony wrote: >>>>>> >>>>>> I guess I can do this: >>>>>>> https://groups.google.com/forum/#!topic/web2py/AYORqIEpc9E >>>>>>> But that kills all the style. Then I got to custom style it. >>>>>>> >>>>>> >>>>>> Just look at the HTML generated by auth.navbar() and replicate that >>>>>> HTML, just making the changes you need in the links. >>>>>> >>>>>> Anthony >>>>>> >>>>> -- 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.