Add basic CSV export, mac db update

This commit is contained in:
2026-04-08 09:24:36 -05:00
parent 2af690ee15
commit 6952402178
7 changed files with 85 additions and 5 deletions

View File

@@ -404,6 +404,18 @@ def locations_list():
entry.delete_instance()
else:
print(entry.name, "Parent:", p)
def dump_csv():
out = "Barcode,Part Number,Serial,MAC,FW Version,Manufacturer,Description,Location,Office,Checked out,Checkout location,Checkout user,Checkout start time,Checkout end time\r\n"
query = item.select()
for itm in query:
out += f"\"{itm.barcode}\",\"{itm.fullname}\",\"{itm.serial}\",\"{itm.mac}\",\"{itm.fwver}\",\"{itm.manufacturer}\",\"{itm.description}\",\"{itm.loc}\",\"{itm.office}\",\"{itm.checkout}\",\"{itm.checkout_loc}\",\"{itm.checkout_user}\",\"{itm.checkout_start}\",\"{itm.checkout_end}\"\r\n"
return out
def test2():
print(dump_csv())
def test():
costa = create_user("Costa Aralis", "caralpwtwfpis", "12345")
@@ -434,4 +446,4 @@ def test():
if __name__ == "__main__":
init()
test()
test2()