Django 1.9 date object import from csv
<p>The date from my csv is in the format mm/dd/yyyy</p>

<p>I edited settings.py to include:</p>

<pre><code>DATE_INPUT_FORMATS = [
    '%Y-%m-%d', '%m/%d/%Y', '%m/%d/%y'] 
    # '2006-10-25', '10/25/2006', '10/25/06'
</code></pre>

<p>When assigning the csv row to the db model, I get this error:</p>

<pre><code>TypeError: an integer is required (got type str)
</code></pre>

<p>This is my code:</p>

<pre><code>import os
import sys
import csv
import django
from datetime import date as django_date

sys.path.append("/home/nerdbox2/django_/logbook/")
os.environ["DJANGO_SETTINGS_MODULE"] = "logbook.settings"
django.setup()

from flights.models import Flight

f = Flight()

reader = csv.reader(open('path to file'))


for row in reader: #reads row from csv


f.date = django_date(row[0])
f.aircraft = row[1]
f.save()
</code></pre>

<p>If I do something like: <code>f.date = django_date(int(row[0]))</code></p>

<p>I get: <code>ValueError: invalid literal for int() with base 10: 'date'</code></p>

<p>I think the problem is that since the input format is <code>yyyy/mm/dd</code> that the <code>'/'</code> character can't be turned into an <code>int()</code> but how to I make the string into a date object that Django will accept?</p>