title: Django Unhasable Type List even though im passing in an object ?(many to many field)
body: <p>I am trying to run a migration script for my django app, but I keep getting <code>TypeError: unhashable type: 'list'</code> even though I am clearly passing in an Object:</p>
  
  <p>I get: </p>
  
  <pre><code> error line 87, in buildCisc
      c.exclusions.add(exclus)
  line 944, in add
      self._add_items(
  line 1119, in _add_items
      target_ids = self._get_target_ids(target_field_name, objs)
  line 1059, in _get_target_ids
      target_ids.add(target_id)
  TypeError: unhashable type: 'list'
  </code></pre>
  
  <p>when I run the following code</p>
  
  <pre><code>...
  
          for ex in exclusionList:
              if len(Course.objects.filter(ID=ex)) &gt; 0:  # exclusion course already exsists
                  exclus = Course.objects.filter(ID=ex)
                  c.exclusions.add(exclus[0])
              else:  # exclusion course does not exsist yet so we must create it first
                  exclus = Course(ID=ex)
                  exclus.save()
                  c.exclusions.add(exclus) #this is line 87 causing the error
  </code></pre>
  
  <p>where <code>c</code> is a Course object create in prior code, <code>exclusions</code> is a many to many field from Course to itself, 'ex' is just a string.
  if I try using <code>exclus = Course.objects.create(ID=ex)</code> instead that also gives the same error. The error seems to be saying that the exclus that I am passing in to <code>c.exclusions.add</code> is a list, but it is very clearly an object. I even tried switching exclus to exclus[0] to see if it somehow thought it was a list, but this gave me <code>error: Course Object not iterable</code> so it is saying it is of type Object, so I am very confused with error message. any ideas?</p>
  
  <p>edit: I believe to have solved the issue, the <code>exclus = Course(ID=ex)</code> was the problem, specifically <code>ex</code>. For some reason in my read in phase, it got set to a list somehow and not a string like I thought it was</p>