title: How do I use one of the model's fields as one of the limits in a range query on itself?
body: <p>I have a model defined in Django as such</p>
  
  <pre><code>model TempModel(models.Model):
      foo = models.IntegerField()
      bar = models.IntegerField()
  </code></pre>
  
  <p>One of my queries is structured as </p>
  
  <pre><code>Q(bar__range=(lower_limit, upper_limit))
  </code></pre>
  
  <p>However, I want to use the value in my foo field as the lower_limit. I tried using F objects for the same</p>
  
  <pre><code>from django.db.models import Q, F
  
  Q(bar__range=(F('foo'), upper_limit)
  </code></pre>
  
  <p>However, this gave me an error:</p>
  
  <pre><code>int() argument must be a string or a number, not 'F'
  </code></pre>
  
  <p>What can I do instead to use my foo field value as one of the limits?</p>