title: Unsupported lookup 'product_name' for CharField or join on the field not permitted. Django Python ORM
body: <blockquote>
    <p>When i click on the provided link it must show the products related to the particular shop but i get an error <strong>Unsupported lookup 'product_name' for CharField or join on the field not permitted.</strong></p>
  </blockquote>
  
  <p>Please suggest on this </p>
  
  <p>product_name is the foreign key for ProductDetails and shop is the foreign key for Products</p>
  
  <blockquote>
    <p>this is the template</p>
  </blockquote>
  
  <pre><code>&lt;a href="{{shop.shop_slug}}"&gt;&lt;strong&gt;{{shop.shop_location}}&lt;/strong&gt;&lt;/a&gt;
  </code></pre>
  
  <blockquote>
    <p>This is views.py</p>
  </blockquote>
  
  <pre><code>    # first check to see if the url is in categories.
  
      categories = [c.shop_slug for c in Shop.objects.all()]
      if single_slug in categories:
          matching_series = Product.objects.filter(shop_name__shop_slug=single_slug)
          series_urls = {}
  
          for m in matching_series.all():
              part_one = Product.objects.filter(product_name__product_name=m.product_name)
              series_urls[m] = part_one
  
          return render(request=request,
                        template_name='products/shop_products.html',
                        context={"product_name": matching_series, "part_ones": series_urls})
  
      products = [t.product_slug for t in Product.objects.all()]
      if single_slug in products:
          return HttpResponse(f"{single_slug} is a product")
  
      return HttpResponse(f"{single_slug} does not correspond")
  </code></pre>
  
  <blockquote>
    <p>This is Models.py</p>
  </blockquote>
  
  <pre><code>from django.db import models
  
  # Create your models here.
  
  # For shop in the beginning
  
  
  # class ShopType(models.Model):
  #     shop_type = models.CharField(max_length=50)
  #     shop_type_description = models.TextField()
  
  #     def __str__(self):
  #         return self.shop_type
  
  
  class Shop(models.Model):
      shop_name = models.CharField(max_length=50)
      shop_location = models.CharField(max_length=100)
      shop_opening_time = models.CharField(max_length=10)
      shop_slug = models.CharField(max_length = 20)
      # shop_type = models.ForeignKey(
      #     ShopType, default=1, on_delete=models.SET_DEFAULT)
      shop_image = models.ImageField(upload_to='products', null=True, blank=True)
      shop_owner = models.CharField(max_length=100)
      shop_description = models.TextField()
      shop_added_date = models.DateTimeField(auto_now=True)
  
      def __str__(self):
          return self.shop_name
  
  
  class Product(models.Model):
      product_name = models.CharField(max_length=100)
      product_description = models.TextField()
      product_image = models.ImageField(
          upload_to='products', null=True, blank=True)
      product_price = models.DecimalField(max_digits=10, decimal_places=2)
      product_slug = models.CharField(max_length = 20)
      product_added_date = models.DateTimeField(auto_now=True)
      shop_name = models.ForeignKey(
          Shop, default=1, on_delete=models.SET_DEFAULT)
  
      def __str__(self):
          return self.product_name
  
  
  class ProductDetails(models.Model):
      product_name = models.ForeignKey(
          Product, default=1, on_delete=models.SET_DEFAULT)
      test_something = models.CharField(max_length=20)
  
      def __str__(self):
          return self.test_something
  
  </code></pre>