title: Django: `Related Field got invalid lookup: icontains`
body: <p>I am creating an image sharing website....</p>
  
  <p>PROBLEM 1:
  here is a screen shot of the search page of images
  <a href="https://i.stack.imgur.com/CdNx4.png" rel="nofollow noreferrer">enter image description here</a>
  The problem here is, when I search by tag, there is an error message: <code>Related Field got invalid lookup: icontains</code></p>
  
  <p>PROBLEM 2: here is a screen shot of the upload page of an image
  <a href="https://i.stack.imgur.com/CZzR7.png" rel="nofollow noreferrer">enter image description here</a>
  The problem is, I can only pick tags but not input new tag here. I want it to be able to let uploader of image to input at most 10 tags....</p>
  
  <p>Here are my codes:</p>
  
  <p>models.py</p>
  
  <pre><code>class Tag(models.Model):
      tag_name = models.CharField(max_length=50)
      def __str__(self):
          return self.tag_name
  
  
  class Image(models.Model):
      category = models.ForeignKey(Category,  blank=True, null=True, on_delete=models.DO_NOTHING)
      in_gallery = models.ManyToManyField(Gallery,  blank=True)
      tag = models.ManyToManyField(Tag, blank=True)
      title = models.CharField(max_length=100)
      photo = models.FileField()
      description = models.CharField(max_length=1000)
      def __str__(self):
          return self.title + '-' + self.description
  
      def regions_changed(sender, **kwargs):
          if kwargs['instance'].tag.count() &gt; 1:
              raise ValidationError("You can't assign more than three regions")
  
  
  class ImageTag (models.Model):
      image = models.ForeignKey(Image,  blank=True, null=True, on_delete=models.DO_NOTHING)
      tag = models.ForeignKey(Tag,  blank=True, null=True, on_delete=models.DO_NOTHING)
  </code></pre>
  
  <p>filters.py </p>
  
  <pre><code>class ImageFilter(django_filters.FilterSet):
      title = django_filters.CharFilter(lookup_expr='icontains')
      description = django_filters.CharFilter(lookup_expr='icontains')
      tag = django_filters.CharFilter(lookup_expr='icontains')
      class Meta:
          model = Image
          fields = ['title', 'description', 'category', 'tag']
  
  
  class NullFilter(django_filters.FilterSet):
      class Meta:
          model = Image
          fields = ['upload_date']
  </code></pre>
  
  <p>views.py</p>
  
  <pre><code>class ImageCreate (CreateView):
      model = Image
      fields = ['category', 'title', 'photo', 'description', 'tag']
      def form_valid(self, form):
          form.instance.owner = self.request.user.profile
          return super().form_valid(form)
  </code></pre>
  
  <p>image_form.html</p>
  
  <pre><code>&lt;form class="form-horizontal" action="" method="post" enctype="multipart/form-data"&gt;
      {% csrf_token %}
      {% include 'imagebank/form-template.html' %}
              &lt;button type="submit" class="btn btn-success"&gt;Submit&lt;/button&gt;
  &lt;/form&gt;
  </code></pre>