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
42
43
44
45
46
47
|
# -*- 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 ... import db
from ...models import *
from .forms import *
invoices = Blueprint("invoices", __name__)
@invoices.route("/modules/invoices")
@login_required
def view():
modules = Module.query.all()
page = request.args.get('page', 1, type=int)
invoices = Invoice.query.order_by(Invoice.primary_key.desc()).paginate(page=page, per_page=5)
module = "invoices"
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,
)
@invoices.route("/modules/invoices/preview/<int:pk>")
@login_required
def preview(pk):
invoice = Invoice.query.filter_by(primary_key=pk).first()
return render_template("modules/invoice-preview.html", invoice=invoice)
|