vendor csv importer

This commit is contained in:
David Lenwell 2013-10-31 02:24:07 -07:00
parent cc969e8ccc
commit a1ec2eb70d

14
scripts/import_vendors.py Executable file
View File

@ -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()