Profile onaccept works but my logic is wrong I am guessing because it escapes and always end up going to index page
Basically I am trying to update the form (which I call form2) with the info that was used to create db.consumer
in db I have
auth.settings.profile_onaccept = lambda form: profile_update(form)
db.define_table("consumer",
Field("seller_profile", 'reference auth_user', readable = False, writable = False, widget=SQLFORM.widgets.options.widget, requires= IS_EMPTY_OR(IS_IN_DB(db,
db.auth_user.id))),
Field("profile_statement", "text", label='Profile hightlights*',requires=IS_NOT_EMPTY(),comment='Write few things to summarize your profile'))
That brings it to the controller
def profile_update(form):
form2 = [];
db.consumer.seller_profile.default = auth.user_id
if form.vars.user_type != 'Seller':
redirect(URL('default','index'))
else:
query = (db.consumer.created_by==auth.user_id);
profile= db(query).select();
form2 = SQLFORM(db.consumer,profile[0].id,deletable=True, submit_button='Update Profile').process()
if form2.accepted:
session.flash = T('Profile is modified')
return dict(form2 = form2)
in view profile_update I have {{=form2}}
Any thoughts?
On Tuesday, May 17, 2016 at 4:37:37 AM UTC-4, villas wrote:
There is:
profile_next and profile_onaccept