{# -*- mode: web; -*- #} {% extends "base.html" %} {% block title %}Add a new invoice{% endblock %} {% block content %} {% if message %} {# the form was submitted and message exists #}

{{ item }}

{# links #}

Submit another {{ item }}

Return to the index

{% else %} {# the form is displayed when template opens via GET not POST #} {# show flash - based on WTForms validators see https://pythonprogramming.net/flash-flask-tutorial/ get_flashed_messages() exists here because of flash() in the route function #} {% with errors = get_flashed_messages() %} {% if errors %} {% for err in errors %} {% endfor %} {% endif %} {% endwith %} {# end of flash #} {# the form #}
Add a new {{ item }} to our database. {% for field in form %} {{ field.label() }} {{ field() }}
{% endfor %}
{% endif %} {% endblock %}