Ir al contenido
Menú
Se marcó esta pregunta
1 Responder
13418 Vistas

Hello,

I created a module on website (frontend). I do some stuff in my controller. When all is done correctly, I redirect the user to another page using "return http.request.redirect('/module/example')"

I would like to pass a parameter with this redirection. On the template of route "/module/example", I would like to display a success message on the top of the page if a have received a specific parameter.

How can I do this?

Thanks

Avatar
Descartar
Mejor respuesta

Hello,

Have you find answer for this? Please share..


Avatar
Descartar

You can store a key in session dict

request.session.update({'a':1})

return request.redirect('/ownership')

And then

@http.route('/ownership', auth='public',website=True)

if request.session.get('a')==1:

alert_check = True

else:

alert_check = False

request.session.update({'a':0})

You can use this check in template

<t t-if="alert_check">

<div class="row">

<div class="col-sm-3"></div>

<div class="col-sm-5">

<div class="alert alert-success alert-dismissible rounded-0 fade show d-print-none css_editable_mode_hidden">

<div class="container">

<p role="alert">

<h6 style="color:white">You have successfully save the data.</h6>

</p>

</div>

<button style="color:white" type="button" class="close" data-dismiss="alert" aria-label="Close"> × </button>

</div>

</div>

<div class="col-sm-3"></div>

</div>

</t>

Publicaciones relacionadas Respuestas Vistas Actividad
2
jul 24
4152
3
abr 24
4817
0
sept 21
1920
1
mar 15
4715
5
jul 25
16218