Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
1 Răspunde
12655 Vizualizări

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

Imagine profil
Abandonează
Cel mai bun răspuns

Hello,

Have you find answer for this? Please share..


Imagine profil
Abandonează

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>

Related Posts Răspunsuri Vizualizări Activitate
2
iul. 24
3531
3
apr. 24
3944
0
sept. 21
1389
1
mar. 15
4211
5
sept. 24
15155