Here is my model:
class Company(models.Model):
id = models.AutoField(primary_key=True);
name = models.CharField(max_length=100);
address = models.CharField(max_length=100, null=True);
city = models.CharField(max_length=100);
state = models.CharField(max_length=25);
zip = models.IntegerField();
latitude = models.CharField(max_length=20, null=True)
longitude = models.CharField(max_length=20, null=True)
phone = models.CharField(max_length=15, null=True);
website = models.CharField(max_length=50, null=True);
email = models.EmailField(max_length=50, null=True);
hiring = models.BooleanField(default=False);
approved = models.BooleanField(default=False);
date_added = models.DateTimeField(auto_now_add=True);
about_us = models.TextField(max_length=500, null=True);
And I have data like this:
Id: since this is autofield, do i need to enter this?
Name: 1-800 Postcards America's Printing Company
Address: 121 Varick Street, 7th Floor
City: New York
State: NY
Zip: 10013
Latitude: 40.724831999999999
Longitude: -74.00609
Phone: 212-741-1070
Website: http://www.1800postcards.com
Email: info@1800postcards.com
Hiring: No
Approved: True
Date Added: auto added as well, should I add a random date?
About Us: Some about us with, many, commas, possible, etc.
I need to upload about 50+ companies using django to gae datastore. How do I create the csv file to make sure that the data inserts properly?
I’m not 100% sure this would work, but I’d write a python function to read in your file, parse the data line by line, and create and save the Company class. I’d test that out on the dev_appserver.
Then I’d run that function in the remote shell. It should read the text file from the local disc, and save to the real datastore.