title: django get_or_create - performance optimization for a list of objects
body: <p>Consider the following (pseudoPython) code:</p>
  
  <pre><code>l = [some, list]
  for i in l:
      o, c = Model.objects.get_or_create(par1=i["something"], defaults={'par2': i["else"],})
  </code></pre>
  
  <p>assuming that most of the time the objects would be retrieved, not created,</p>
  
  <p>there is an obvious performance gain by quering with a first SELECT() of objects not in the set defined by par1, and then bulk-inserting the missing ones.. </p>
  
  <p>but, is there a neat Python/Django pattern of accomplishing that without diving into SQL? </p>
  
  <p>This is a bulk import routine, so l contains dictionaries, not django model instances. </p>