Add basic CSV export, mac db update
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user