From 1dad22d3e45d6506c8624e3a7111240fcc4ab786 Mon Sep 17 00:00:00 2001 From: Marius Peter Date: Sun, 15 May 2022 13:16:37 +0200 Subject: Templates. --- app/templates/modules/add-invoice.html | 48 ++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 app/templates/modules/add-invoice.html (limited to 'app/templates/modules/add-invoice.html') diff --git a/app/templates/modules/add-invoice.html b/app/templates/modules/add-invoice.html new file mode 100644 index 0000000..92748be --- /dev/null +++ b/app/templates/modules/add-invoice.html @@ -0,0 +1,48 @@ +{# -*- 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 %} -- cgit v1.2.3