Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
13461 มุมมอง

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

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Hello,

Have you find answer for this? Please share..


อวตาร
ละทิ้ง

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 ตอบกลับ มุมมอง กิจกรรม
Data from website with controller แก้ไขแล้ว
2
ก.ค. 24
4165
3
เม.ย. 24
4850
0
ก.ย. 21
1938
1
มี.ค. 15
4736
5
ก.ค. 25
16236