Refactor inventory model relationships to replace 'item' with 'type' for improved clarity and consistency

This commit is contained in:
Yaro Kasear 2025-07-28 13:13:37 -05:00
parent 193c2aec70
commit da60b971f8
5 changed files with 8 additions and 9 deletions

View file

@ -18,7 +18,7 @@ inventory_headers = {
"Bar Code": lambda i: {"text": i.barcode},
"Brand": lambda i: {"text": i.brand.name} if i.brand else {"text": None},
"Model": lambda i: {"text": i.model},
"Item Type": lambda i: {"text": i.item.description} if i.item else {"text": None},
"Item Type": lambda i: {"text": i.type.description} if i.type else {"text": None},
"Shared?": lambda i: {"text": i.shared, "type": "bool", "html": checked_box if i.shared else unchecked_box},
"Owner": lambda i: {"text": i.owner.identifier, "url": url_for("main.user", id=i.owner.id)} if i.owner else {"text": None},
"Location": lambda i: {"text": i.location.identifier} if i.location else {"Text": None},

View file

@ -224,7 +224,7 @@ def get_inventory_csv():
case "owner":
return item.owner.identifier
case "type":
return item.item.description
return item.type.description
case _:
return getattr(item, col, "")
except Exception: