I'm a little new to this, and figuring it out as I go. So far so good, however I have having trouble importing a field that has a foreign key. I have about 10,000 rows in a csv file that I want to add to the database. As you can imagine, entering 10,000 items at a time is too labour intensive. When I try for an import I get this error: ValueError: invalid literal for int() with base 10
This is because (i think) it is trying to match the related model with the id. However the database is empty, so there is no id, and furthermore, the "author" field in my csv (the one with the foreign key) doesn't have an id yet. ( i assume this is created when the record is). Any suggestions?
Sorry in advance for the newbie question.
You state the the database is blank, if so you're going to have to have at least 1 record in the parent table, where the primary key is defined. After that you can use the parent.primary-key value in your CSV file as a dummy value for your foreign key.  That should at least allow you to populate the table.   Later on, as your parent table grows you're going to have to write some sort of script to add the correct parent.primary-key value to each record in the CSV file and then import it.
CSV import into empty Django database with foreign key field