diff --git a/app/templates/orders_all.html b/app/templates/orders_all.html new file mode 100644 index 0000000..49c1ad6 --- /dev/null +++ b/app/templates/orders_all.html @@ -0,0 +1,33 @@ +{% extends 'layout.html' %} +{% set active_page = "orders" -%} + +{% import "bootstrap/wtf.html" as wtf %} +{% import "utils.html" as util -%} + +{% block container %} +
+
+ {% if orders|count > 0 -%} +

Open orders:

+ {% for order in orders %} + {{ util.render_order(order) }} + {% endfor %} + {% else %} +

There are no orders in the history

+ {%- endif %} +
+
+ +{% endblock %} + +{% block styles -%} + {{ super() }} + + + +{%- endblock %} +{% block scripts -%} + {{ super() }} + + +{%- endblock %} diff --git a/app/views/order.py b/app/views/order.py index f96e848..3900c7b 100644 --- a/app/views/order.py +++ b/app/views/order.py @@ -27,6 +27,11 @@ def orders(form: OrderForm = None) -> str: form.populate() return render_template("orders.html", orders=get_orders(), form=form) +@order_bp.route("/all") +def all_orders() -> str: + "Generate the view of all orders" + # pylint: disable=C0121 + return render_template("orders_all.html", orders=Order.query.filter(Order.public == True).all()) @order_bp.route("/create", methods=["POST"]) @login_required