Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add route to view all orders #171

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions app/templates/orders_all.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{% extends 'layout.html' %}
{% set active_page = "orders" -%}

{% import "bootstrap/wtf.html" as wtf %}
{% import "utils.html" as util -%}

{% block container %}
<div class="row orders">
<div class="col-md-5">
{% if orders|count > 0 -%}
<h3>Open orders:</h3>
{% for order in orders %}
{{ util.render_order(order) }}
{% endfor %}
{% else %}
<h4>There are no orders in the history</h4>
{%- endif %}
</div>
</div>
</div>
{% endblock %}

{% block styles -%}
{{ super() }}
<link rel="stylesheet" href="{{ url_for('static', filename='css/select2.min.css') }}" />
<link rel="stylesheet" href="{{ url_for('static', filename='css/bootstrap-datetimepicker.min.css') }}" />
<link rel="stylesheet" href="{{ url_for('static', filename='css/select2-bootstrap.min.css') }}" />
{%- endblock %}
{% block scripts -%}
{{ super() }}
<script src="{{ url_for('static', filename='js/select2.min.js') }}"></script>
<script src="{{ url_for('static', filename='js/moment.min.js') }}"></script>
{%- endblock %}
5 changes: 5 additions & 0 deletions app/views/order.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down