From: W. Trevor King Date: Mon, 2 Apr 2012 16:59:04 +0000 (-0400) Subject: Add lab-inventory and door warning generation to gen-all-inventories.py. X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=48ae54057c3ebea0e2912d8c26e39f8d8253d552;p=chemdb.git Add lab-inventory and door warning generation to gen-all-inventories.py. --- diff --git a/contrib/gen-all-inventories.py b/contrib/gen-all-inventories.py index 85e7018..37fc41f 100755 --- a/contrib/gen-all-inventories.py +++ b/contrib/gen-all-inventories.py @@ -18,6 +18,7 @@ def filename(location, extension='.pdf'): def generate_inventories(): + "Per-location inventories for each location." for location in _models.Location.objects.all(): chemical_instances = location.chemical_instances.all() dg = _doc.DocGen(chemical_instances=chemical_instances) @@ -25,6 +26,23 @@ def generate_inventories(): with open(filename(location), 'wb') as f: f.write(pdf) +def generate_inventory(): + "Single inventory for the whole lab" + chemical_instances = _models.ChemicalInstance.objects.all() + dg = _doc.DocGen(chemical_instances=chemical_instances) + pdf = dg.inventory() + with open('inventory.pdf', 'wb') as f: + f.write(pdf) + +def generate_door_warning(): + "Door warning for the whole lab" + chemical_instances = _models.ChemicalInstance.objects.all() + dg = _doc.DocGen(chemical_instances=chemical_instances) + pdf = dg.door_warning() + with open('door-warning.pdf', 'wb') as f: + f.write(pdf) if __name__ == '__main__': generate_inventories() + generate_inventory() + generate_door_warning()