title: Django: TypeError - argument of type 'QuerySet' is not iterable
body: <p>So this error is very cryptic, how can it be that a <code>Queryset</code> object, even if empty, is not iterable?</p>
  
  <p>This is the rare error I'm seeing:</p>
  
  <pre><code>TypeError: argument of type 'QuerySet' is not iterable
  </code></pre>
  
  <p>And this is the code producing this error:</p>
  
  <pre><code>artist_object = Artist.objects.get(id=id)
  artist_release_groups = artist_object.release_groups.all()
  if rg not in artist_release_groups: # this is the line where the error is  happening
      artist_object.release_groups.add(rg)
  </code></pre>
  
  <p>I don't know if this is relevant, but this is happening in a celery task and the error is being reported in Sentry (an exception reporting service).</p>
  
  <p>Traceback that I have:</p>
  
  <pre><code>TypeError: argument of type 'QuerySet' is not iterable
    File "celery/app/trace.py", line 382, in trace_task
      R = retval = fun(*args, **kwargs)
    File "celery/app/trace.py", line 641, in __protected_call__
      return self.run(*args, **kwargs)
    File "core/tasks.py", line 234, in refresh_artist_task
      get_apple_release_groups_for_artist(applemusic_id)
    File "celery/local.py", line 191, in __call__
      return self._get_current_object()(*a, **kw)
    File "celery/app/trace.py", line 642, in __protected_call__
      return orig(self, *args, **kwargs)
    File "celery/app/task.py", line 375, in __call__
      return self.run(*args, **kwargs)
    File "core/tasks.py", line 147, in get_apple_release_groups_for_artist
      if rg not in artist_release_groups:
  </code></pre>
  
  <p><strong>Update:</strong> not sure, but I think this related to <a href="https://code.djangoproject.com/ticket/26600" rel="noreferrer">this issue on the Django forums</a>. (see last three replies)</p>