Created
September 16, 2012 15:08
-
-
Save serkanh/3732778 to your computer and use it in GitHub Desktop.
Simple CSV importer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.core.management import setup_environ | |
import settings, csv | |
setup_environ(settings) | |
from companies.models import Lead | |
file = csv.reader(open('florida.csv', 'rU'), delimiter = ',', quotechar='|') | |
for row in file: | |
#Name the Django field with corresponding row in your csv. | |
lead = Lead(cname=row[0], crep=row[1], cnumber=row[2], cemail=row[3], caddress=row[4], ccity=row[5],czip=row[6],submissiondate=row[7], businesstype = row[8], comment = row[9]) | |
lead.save() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment