How to implement notification in Flask

flask shopyo

Implementing notifications in Flask goes way beyond using flash. You have to add this snippet in your templates:

<div id="flashed-messages">
  {% with messages = get_flashed_messages() %}
    {% if messages %}
      {% for message in messages %}
        {{ message | safe}}
      {% endfor %}
    {% endif %}
  {% endwith %}


from flask import flash

    return render_template('mytemplate.html')

In shopyo this is situated at box__default/base/templates/base/blocks/flashed_messages.html. Used with {% include 'base/blocks/flashed_messages.html'%}

Free Flask Course