title: Comparison of objects in django
body: <p>Models</p>
  <pre><code>class Weapon_Class(models.Model):
      title = models.CharField(max_length = 50)
      description = models.TextField()
  
      def __str__(self):
          return self.title
  
  class Gun(models.Model):
      weapon_type = models.ForeignKey(Weapon_Class, on_delete = models.CASCADE)
      name = models.CharField(max_length = 50)
      magazine_size = models.IntegerField(default = 0)
      damage = models.IntegerField(default = 0)
      fire_rate = models.IntegerField(default = 0)
      description = models.TextField()
  
  
      def __str__(self):
          return self.name 
  </code></pre>
  <p>Views</p>
  <pre><code>class Weapon_class_view(ListView):
      model = Weapon_Class
      template_name = 'weapon_class.html'
      # print(Weapon_Class.objects.all()[1].headline)
  
      def get_context_data(self, **kwargs):
          context = super().get_context_data(**kwargs)
          context['items'] = Weapon_Class.objects.all().count()
          context['weapons'] = list(Weapon_Class.objects.all())
          context['arm'] = (Gun.objects.all())
     
          return context
  </code></pre>
  <p>Template</p>
  <pre><code>{% for weapon in weapons %}
      &lt;div class = &quot;wepbox&quot; &gt;
          &lt;a href=&quot;#&quot;&gt;&lt;div class = &quot;boxy&quot;&gt;{{ weapon.title }}&lt;/div&gt;&lt;/a&gt;
      &lt;/div&gt;
      {% for g in arm %}
          {% if g.weapon_type == weapon.title %}
              &lt;h1 style=&quot;color: yellowgreen;&quot;&gt;{{g.name}}&lt;/h1&gt;
          {% endif %}
      {% endfor %}
  {% endfor %}
  </code></pre>
  <p>It displays nothing on the browser but it should display the name of different guns like type 25 which is the assault rifle or MW11 which is the pistol</p>