diff --git a/routes/viewall.py b/routes/viewall.py index f94e0fd..96aeaba 100644 --- a/routes/viewall.py +++ b/routes/viewall.py @@ -1,6 +1,7 @@ from flask import Blueprint, request, render_template, send_file from models import Asset, db import csv +from config import item_attributes viewall_bp = Blueprint('viewall', __name__) @@ -16,4 +17,8 @@ def view_list(): return send_file('inventory_export.csv', as_attachment=True) items = Asset.query.all() - return render_template('viewList.html', items=items) \ No newline at end of file + primary_attrib = next( + (attrib for attrib, config in item_attributes.items() if config.primary), + None + ) + return render_template('viewList.html', items=items, item_attributes=item_attributes, primary_attrib=primary_attrib) \ No newline at end of file diff --git a/templates/viewList.html b/templates/viewList.html index 5694a67..0fb9681 100644 --- a/templates/viewList.html +++ b/templates/viewList.html @@ -9,42 +9,31 @@
Asset Tag | -Host Name | -Warranty From | -Status | -Staff No. | + + {% for attrib, config in item_attributes.items() %} +{{ config.display_name }} | + {% endfor %} +Actions | |
---|---|---|---|---|---|---|---|
{{ item[attrib] }} | + {% endfor %}- {{item.assettag}} - | -- {{item.hostname}} - | -- {{item.warrantyfrom}} - | -- {{item.status}} - | -- {{item.staffnum}} - | -- | - |