This question has been flagged
1 Reply
10853 Views

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
Discard
Best Answer

Hello,

Have you find answer for this? Please share..


Avatar
Discard

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>