examples/flash_example_naive.py
from py4web import action
from .common import flash, session
@action("flash_example_naive")
@action.uses("examples/flash_example.html")
def flash_example_naive():
return dict(flash={"message": "hello", "class": "error"})
templates/examples/flash_example.html
[[extend 'layout.html']]
<button onclick="Q.flash({message: 'you clicked the button', class:'warning'})">Click me</button>
<br/>or type something below<br/>
<input onchange="Q.flash({message: this.value, class: 'success'});this.value='';"/>