title: how to do less than or equal to and greater than equal to in django filter?
body: <p>How to do less than or equal to and greater than equal to in django filter? Like , I want to get value around :- <code>10&lt;=val&lt;=50</code> in django view.<br>
  For this I used some query in sql like this :-</p>
  
  <pre><code>select count(*) from table_name where gender='MALE' and age&lt;=50 and age&gt;=10;
  </code></pre>
  
  <p>I tried something like this in django view :-</p>
  
  <pre><code>tablename.objects.filter(Q(gender='MALE'),Q(age__lte=50) &amp; Q(age__gte=10)).count()
  </code></pre>
  
  <p>But I got different values. In sql I got 65 and in django I got 29. sql answer is correct. Please help me to do comparison in django view.  </p>