From a1ec2eb70dc0d2d615a2a621cda266b6ede3aa05 Mon Sep 17 00:00:00 2001 From: David Lenwell Date: Thu, 31 Oct 2013 02:24:07 -0700 Subject: [PATCH] vendor csv importer --- scripts/import_vendors.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100755 scripts/import_vendors.py diff --git a/scripts/import_vendors.py b/scripts/import_vendors.py new file mode 100755 index 00000000..a253e501 --- /dev/null +++ b/scripts/import_vendors.py @@ -0,0 +1,14 @@ +import csv +from refstack.models import * + +_file = 'members_sponsors_20131030.csv' +with open(_file, 'rb') as csvfile: + parsed = csv.reader(csvfile, delimiter=',') + for row in parsed: + print ', '.join(row) + vendor = Vendor() + vendor.vendor_name = row[1] + if row[2]: + vendor.contact_email = row[2] + db.add(vendor) + db.commit() \ No newline at end of file