I thank you for your help villas and much appreciated. I guess the only two 
difference between your approach and mine is:

(1)
profile[0].id =   consumer_rec = db(query).select().first()

I believe they works the same. 

(2)
But I may be wrong in doing. 

You have:

    form2 = SQLFORM(db.consumer, consumer_rec, deletable=True, submit_button
='Update Consumer Profile')

  if form2.process().accepted:

I did. 

  form2 = SQLFORM(db.consumer,profile[0].id,deletable=True, 
submit_button='Update Profile').process()

if form2.accepted:

 Am I correct?



On Wednesday, May 18, 2016 at 6:50:52 AM UTC-4, villas wrote:
>
> Hi Ron
>
> Whilst I am still not totally clear in what you are trying to do,  it 
> seems that your code to create your form2 is not written correctly.  Maybe 
> you can change it a little and simply redirect to this similar function ...
>
> def consumer_update():
>     if auth.user.user_type != 'Seller':
>         redirect(URL('default','index'))
>     query  = (db.consumer.created_by==auth.user_id);
>     consumer_rec = db(query).select().first()
>
>     db.consumer.seller_profile.default = auth.user_id
>     form2 = SQLFORM(db.consumer, consumer_rec, deletable=True, 
> submit_button='Update Consumer Profile')
>     if form2.process().accepted:
>           session.flash = T('Profile is modified')
>           redirect(URL('index')) 
>     elif form2.errors:
>           response.flash = 'form has errors'
>     return dict(form2=form2)
>
>
>
>
>

-- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to