i made this way:
in controller default:
session.path='http://'+request.env.http_host+request.env.path_info
in controller gestione/update:
redirect(session.path)
it seems it is working but i wonder if this is the correct solution
On 3 Dic, 10:26, pmate <[EMAIL PROTECTED]> wrote:
> Ciao Massimo,
> this is my update function in controller gestione.py:
>
> def update():
> try:
> dbname=request.args[0]
> db=eval(dbname)
> table=request.args[1]
> except:
> response.flash=T('invalid request')
> redirect(URL(r=request,f='index'))
> try:
> id=int(request.args[2])
> record=db(db[table].id==id).select()[0]
> except:
> session.flash=T('record does not exist')
> redirect(URL(r=request,f='select/%s/%s'%(dbname,table)))
> form=SQLFORM(db[table],record,deletable=True,
> linkto=URL(r=request,f='select',args=[dbname]),
> upload=URL(r=request,f='download',args=[dbname]))
> if form.accepts(request.vars,session):
> response.flash=T('done!')
> redirect(URL(r=request,f='select/%s/%s'%(dbname,table)))
> return dict(form=form)
>
> this is the calling action in controller default.py:
>
> @t2.requires_login(next='login')
> def provvedimenti_insert():
> id=request.args[1]
> linkto=URL(r=request,f='../gestione/update/db')
> nomin=db(db.nominativi.id==id).select()
> provv=db(db.provvedimenti.nominativi_id==id).select
> (orderby=~db.provvedimenti.data)
> nominativi=SQLTABLE(nomin,_class='sortable',headers=headers)
> provvedimenti=SQLTABLE
> (provv,linkto,_class='sortable',headers=headers)
> return dict
> (nominativi=nominativi,provvedimenti=provvedimenti,id=id)
>
> i tried
> redirect(request.env.http_referer)
> as you suggested but it didn't work
>
> Paolo
>
> On 3 Dic, 03:45, mdipierro <[EMAIL PROTECTED]> wrote:
>
> > PS. Your english is not bad all. Now worse than mine anyway. ;-)
>
> > On Dec 2, 6:55 pm, pmate <[EMAIL PROTECTED]> wrote:
>
> > > Hi all,
> > > my update function ends with:
> > > ......
> > > if form.accepts(request.vars,session):
> > > response.flash=T('done!')
> > > redirect(URL(r=request,f='select/%s/%s'%(dbname,table)))
>
> > > ok, so when a form is validated, an update is performed and there is
> > > the redirection to a prefixed page.
> > > But i can have access to update page from wherever i like, right? Is
> > > there a way, once that form is validated, to be redirected to the page
> > > that called the update?
> > > For example, from /default/myfunc/names/26 in my (linkto)list i
> > > choose one id and i go to update that record in /appadmin/update/db/
> > > example/idchosen. Once finished i would go back to /default/myfunc/
> > > names/26 and not to f='select/%s/%s'%(dbname,table).
> > > How can i do?
> > > thanks
>
> > > ...my english is so bad...
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py Web Framework" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---