Start work on orders.

Commit
8900d1895eb2067b3ff5aa07763d302b7687fbcf
Author
Marius Peter <marius.peter@tutanota.com>
Author date
Committer
Marius Peter <marius.peter@tutanota.com>
Committer date
Changed files
app/__init__.py
index 3d1bac6d..0e553b39 100644..100644
@@ -28,7 +28,7 @@
28 28
29 29 app.register_blueprint(main)
30 30
31 Removed: from .modules import common, auth, products, customers, ferti, invoices
31 Added: from .modules import common, auth, products, customers, ferti, invoices, orders
32 32
33 33 app.register_blueprint(common)
34 34 app.register_blueprint(auth)
@@ -36,5 +36,7 @@
36 36 app.register_blueprint(customers)
37 37 app.register_blueprint(ferti)
38 38 app.register_blueprint(invoices)
39 Added: app.register_blueprint(orders)
40 Added:
39 41
40 42 return app
app/modules/__init__.py
index 56f1d5af..467e59ae 100644..100644
@@ -6,3 +6,4 @@
6 6 from .customers.routes import customers
7 7 from .ferti.routes import ferti
8 8 from .invoices.routes import invoices
9 Added: from .orders.routes import orders
app/modules/orders/routes.py
index 4027a449..0d2e66a4 100644..100644
@@ -21,10 +21,24 @@
21 21
22 22
23 23 from ... import db
24 Removed: from ...models import *
24 Added: from ...models import Module, Order
25 25 from .forms import *
26 26
27 27
28 28 orders = Blueprint("orders", __name__)
29 29
30 30
31 Added: @orders.route("/modules/orders")
32 Added: @login_required
33 Added: def view():
34 Added: modules = Module.query.all()
35 Added: page = request.args.get('page', 1, type=int)
36 Added: orders = Order.query.order_by(Order.primary_key.desc()).paginate(page=page, per_page=5)
37 Added: module = "orders"
38 Added: flash(f"Successfully accessed module {module}.", "info")
39 Added: flash(f"Still fighting against styling in {module}.", "error")
40 Added: return render_template(
41 Added: f"modules/{module}.html",
42 Added: modules=modules,
43 Added: invoices=invoices,
44 Added: )