title: Django IntegrityError with get_or_create
body: <p>Im having an issue with Django's get_or_create, i have seen this issue in a few posts already explaning that its a MySQL issue, so i followed this post
  <a href="http://www.no-ack.org/2010/07/mysql-transactions-and-django.html" rel="nofollow">http://www.no-ack.org/2010/07/mysql-transactions-and-django.html</a></p>
  
  <p>Which basically says that <code>get_or_create</code> will return an <code>IntegrityError</code> when creating objects concurrently because of MySQL's default transaction-isolation of <code>REPEATABLE READ</code>.</p>
  
  <p>I did as the post suggested which was to add <code>transaction-isolation = READ-COMMITTED</code> to my 
  <code>/etc/mysql/my.cnf</code> file, but got the same error. So im wondering if there's any other solution.</p>
  
  <p>Here's a sample model to replicate the issue</p>
  
  <pre><code>class Author(models.Model):
      name = models.CharField(max_length=100, unique=True)
  
  class Book(models.Model):
      name = models.CharField(max_length=100, unique=True)
      author = models.ForeingKey(Author)
  </code></pre>
  
  <p>If i have a long list of authors and books, some repeated. And i run a forloop to iterate through each author/book using get_or_create to create or get the respective object, it will throw an IntegrityError.</p>
  
  <p>The loop is something similar to..</p>
  
  <pre><code>authors = ['Author1', 'Author2', 'Author3', 'Author4', 'Author5']
  books = ['book1', 'book2', 'book3', 'book4', 'book5']
  
  for author, book in zip(authors, books):
      author = Author.objects.get_or_create(name=author)[0]
      author.book_set.get_or_create(name=book) # Error happens here
  </code></pre>