title: Django Simple Template Tag Questions
body: <p>I'm a student who is learning how to play Django. You are about to output a p-tag using template tags in the vault. The template tag I want to use is &quot;When option.product_code and product.product_code are the same in the Option table, print out if there are two options.option_code&quot;. How should I fill out the if statement?</p>
  <p>I'd like to add <p> Hello </p> by referring to the above. Please give me some advice.</p>
  <p><strong>Models.py</strong></p>
  <pre><code>class Product(models.Model):
      product_code = models.AutoField(primary_key=True)
      name = models.CharField(max_length=200, db_index=True)
      image = models.ImageField(upload_to='products/%Y/%m/%d', blank=True)
  
      class Meta:
          ordering = ['product_code']
  
      def __str__(self):
          return self.name
  
  
  class Option(models.Model):
      option_code = models.AutoField(primary_key=True)
      name = models.CharField(max_length=32)
      product_code = models.ForeignKey(Product, on_delete=models.CASCADE, db_column='product_code')
  
      def __str__(self):
          return self.name
  
      class Meta:
          ordering = ['option_code']
  </code></pre>
  <p><strong>views.py</strong></p>
  <pre><code>def index(request):
          products = Product.objects.prefetch_related('option_set').annotate(noption=Count('option_set'))
  
  
      return render(request, 'option/option_list.html', {'products':products})
  </code></pre>
  <p><strong><strong>templates</strong></strong></p>
  <pre><code>{% for product in products %}
      {% for option in product.option_set.all %}
              {% if product.noption &gt;= 2 %}
  
  &lt;p&gt; hello! &lt;/p&gt;
  
  {% endif %}
  {% endfor %}{% endfor %}
  </code></pre>
  <p><strong>ERROR :</strong></p>
  <pre><code>Cannot resolve keyword 'option_set' into field. Choices are: product_code, name, option
  </code></pre>