summaryrefslogtreecommitdiff
path: root/app/modules/orders/routes.py
blob: cf4e70abea3afa03c7b199ce0a96c0b7313fb921 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# -*- mode: python; -*-


from flask import (
    Blueprint,
    render_template,
    send_file,
    request,
    redirect,
    flash,
    url_for,
    jsonify,
    abort,
)
from flask_login import login_required, current_user




from ...models import db, Module, Order, Invoice
from .forms import *


orders = Blueprint("orders", __name__)


@orders.route("/modules/orders")
@login_required
def view():
    modules = Module.query.all()
    page = request.args.get('page', 1, type=int)
    orders = Order.query.order_by(Order.primary_key.desc()).paginate(page=page, per_page=5)
    invoices = Invoice.query.order_by(Invoice.primary_key.desc()).paginate(page=page, per_page=5)
    module = "orders"
    flash(f"Successfully accessed module {module}.", "info")
    flash(f"Still fighting against styling in {module}.", "error")
    return render_template(
        f"modules/{module}.html",
        modules=modules,
        invoices=invoices,
    )
Copyright 2019--2024 Marius PETER