From 9770cf8345d47cb086bd386c0d5c0fca165a6d11 Mon Sep 17 00:00:00 2001 From: Marius Peter Date: Fri, 22 Apr 2022 13:24:41 +0200 Subject: First commit! :fire: --- app/templates/add_product.html | 44 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 app/templates/add_product.html (limited to 'app/templates/add_product.html') diff --git a/app/templates/add_product.html b/app/templates/add_product.html new file mode 100644 index 0000000..ad7ea0a --- /dev/null +++ b/app/templates/add_product.html @@ -0,0 +1,44 @@ +{# -*- mode: jinja2; -*- #} + +{% extends "base.html" %} +{% import "bootstrap/wtf.html" as wtf %} + +{% block content %} + + {% block title %}Add a New Product{% endblock %} + + {% if message %} + + {# the form was submitted and message exists #} +

{{ message }}

+ {# links #} +

Submit another product.

+

Return to the index.

+ +{% else %} + + {# the form is displayed when template opens via GET not POST #} +

Add a new sock to our inventory.

+

Return to the index.

+{# 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, thanks to WTForms #} +{{ wtf.quick_form(form) }} + +{% endif %} +{% endblock %} -- cgit v1.2.3