title: Django TypeError object of type 'ManyRelatedManager' has no len()
body: <p>I am trying to customise the create method for Combination objects. The field tag_id should be limited to 2 Tag instances. I have tried something like</p>
  <pre><code>if len(combination.tag_id) == 2:
  </code></pre>
  <p>and I am getting the error object of type 'ManyRelatedManager' has no len()</p>
  <p>Is there another way to set the maximum length of this field to 2?</p>
  <p><strong>models.py</strong></p>
  <pre><code>class Combination(models.Model):
  
      user = models.ForeignKey(CustomUser, on_delete=models.SET_NULL, null=True)
      gameround = models.ForeignKey(Gameround, on_delete=models.CASCADE, null=True)
      resource = models.ForeignKey(Resource, on_delete=models.CASCADE, null=True)
      tag_id = models.ManyToManyField(Tag, null=True)
      created = models.DateTimeField(editable=False)
      score = models.PositiveIntegerField(default=0)
  
      objects = models.Manager()
  
      def __str__(self):
          return str(self.tag_id) or ''
  </code></pre>
  <p><strong>serializers.py</strong></p>
  <pre><code>  def create(self, validated_data):
      user = None
      request = self.context.get(&quot;request&quot;)
      if request and hasattr(request, &quot;user&quot;):
        user = request.user
  
      score = 0
      resource_id = validated_data.get(&quot;resource&quot;)
  
      combination = Combination(
        user=user,
        gameround=validated_data.get(&quot;gameround&quot;),
        resource=validated_data.get(&quot;resource&quot;),
        created=datetime.now(),
        score=score
      )
      combination.save()
  
      tag_data = validated_data.pop('tag_id', None)
      for tag_item in tag_data:
        tag = Tag.objects.get_or_create(**tag_item)[0]
        combination.tag_id.add(tag)
  
        # if len(combination.tag_id) == 2:
      return combination
  </code></pre>