title: How can I compare two fields of a model in a query?
body: <p>I'm writing a management command which will filter a product's original price with suggested prices. </p>
  
  <p>I have a product model which looks like :</p>
  
  <pre><code>class Suggestion(models.Model):
      ....
      price = models.IntegerField()
  
  class Product(models.Model):
      price = models.IntegerField()
      suggestions = models.ManyToManyField(Suggestion)
  </code></pre>
  
  <p>I want to filter all products whose price is equal to minumum suggestion. Something should like :</p>
  
  <pre><code>Product.objects.filter(price = minumum(suggestions))
  </code></pre>
  
  <p>AND</p>
  
  <p>I want to filter products where the suggestions contains the Product's original price. Something should like : </p>
  
  <pre><code>Product.objects.filter(price__in = self.suggestions)
  </code></pre>
  
  <p>The problem is I can't use a for-loop to look each Product's minumum suggestion and as you guess I can't use object's <strong>self</strong> either, so how can I compare two fields of a model in a query ? </p>