How to add queryset to ManyToMany relationship?
<p>I have following models:</p>

<pre><code>class EnMovielist(models.Model):
    content_ID = models.CharField(max_length=30)
    release_date = models.CharField(max_length=30)
    running_time = models.CharField(max_length=10)
    actress = models.CharField(max_length=300)
    series = models.CharField(max_length=30)
    studio = models.CharField(max_length=30, null=True)
    director = models.CharField(max_length=30)

    def __str__(self):
        return self.content_ID


class EnActress(models.Model):
    name = models.CharField(max_length=100, null=True)
    movielist = models.ManyToManyField(EnMovielist, related_name='movies')

    def __str__(self):
        return self.name
</code></pre>

<p>I got error when I try to this in Django shell,</p>

<pre><code>b = EnActress.objects.values_list('name', flat=True)
a = EnMovielist.objects.filter(actress__contains=b).values_list('content_ID')

b.movielist.add(a)



AttributeError: 'QuerySet' object has no attribute 'movielist'
</code></pre>

<p>How can I django queryset add into many-to-many field?
I have no idea why this is happening.. Any help appreciated! :)</p>

<p>You should call m2m <code>add</code> from instance and adding entity should be also model instance. Otherwise your expression doesn't make sense.  </p>

<pre><code>b = EnActress.objects.get(pk=some_pk) # get an instance, not queryset
a = EnMovielist.objects.get(pk=some_pk) # also instance
b.movielist.add(a)
</code></pre>

python django django-queryset manytomanyfield