title: How to use nested lookup in django?
body: <p>Was facing difficulties in using nested lookups for many-to-many field in django.</p>
  
  <p>Please find code snippet below :</p>
  
  <pre><code>class Tags(models.Model):
      type = models.ForeignKey(Type,related_name="tags_college",null=True)
      tag = models.CharField(max_length = 200)
  
  class Query(models.Model):
      query = models.CharField(max_length = 200)
      tags = models.ManyToManyField(Tags,related_name="query_tags")
  </code></pre>
  
  <p>Need to make a query on Query table where all tag in many-to-many field of query table must have tags with type attribute equal to null .</p>