title: How to write python-django queires and import them?
body: <p><strong>Data :</strong> </p>
  
  <pre><code>{
    "Fruit": "Pomegranate",
    "District": "Nasik",
    "Taluka": "Nasik",
    "Revenue circle": "Nasik",
    "Sum Insured": 28000,
    "Area": 1200,
    "Farmer": 183
  }
  
  {
    "Fruit": "Pomegranate",
    "District": "Jalna",
    "Taluka": "Jalna",
    "Revenue circle": "Jalna",
    "Sum Insured": 28000,
    "Area": 120,
    "Farmer": 13
  }
  
  {
    "Fruit": "Guava",
    "District": "Pune",
    "Taluka": "Haveli",
    "Revenue circle": "Uralikanchan",
    "Sum Insured": 50000,
    "Area": 10,
    "Farmer": 100
  }
  
  {
    "Fruit": "Guava",
    "District": "Nasik",
    "Taluka": "Girnare",
    "Revenue circle": "Girnare",
    "Sum Insured": 50000,
    "Area": 75,
    "Farmer": 90
  }
  
  {
    "Fruit": "Banana",
    "District": "Nanded",
    "Taluka": "Nandurbar",
    "Revenue circle": "NandedBK",
    "Sum Insured": 5000,
    "Area": 2260,
    "Farmer": 342
  }
  
  {
    "Fruit": "Banana",
    "District": "Jalgaon",
    "Taluka": "Bhadgaon",
    "Revenue circle": "Bhadgaon",
    "Sum Insured": 5000,
    "Area": 220,
    "Farmer": 265
  }
  </code></pre>
  
  <p>I want to write all types of combination queries, if someone wants information only for Fruit which is Guava then the output will be exact data for Guava only.</p>
  
  <p>also if someone wants information only for Fruit which is Banana &amp; Guava then the output will be exact data for Banana and Guava.</p>
  
  <p>If fruit is equal to Banana</p>
  
  <p>output will be data for Banana</p>
  
  <p>If fruit is equal to Guava</p>
  
  <p>output will be data for Guava</p>
  
  <p>If fruit is equal to Banana and Guava</p>
  
  <p>output will be data for Banana and Guava</p>
  
  <p>Also, if someone wants information only for District which is Nasik then the output will be exact data for Nasik district only. Query for "District"</p>
  
  <p>If District is equal to Nasik</p>
  
  <p>output will be data for Nasik District</p>
  
  <p>If District is equal to Nanded</p>
  
  <p>output will be data for Nanded District</p>
  
  <p>likewise, there is query for "Revenue_circle, Farmer etc.</p>
  
  <p>I know how to write this queries in mongoshell using find</p>
  
  <p>db.Wbcis.find({"Fruit":"Banana"})</p>
  
  <p>db.Wbcis.find({"District":"Nasik"}) etc...</p>
  
  <p>but I want to writing the queries  in the python script so I am confuse in models.py and views.py file.</p>
  
  <p>I tired and type query  using Q objects in  models.py</p>
  
  <p><strong>models.py</strong></p>
  
  <pre><code>from django.contrib.auth.models import User
  
  from django.db import models
  
  from django.db.models import Q
  
  class Wbcis(models.Model):  
    Fruit = models.CharField(max_length=50)  
    District = models.CharField(max_length=50)   
    Taluka = models.CharField(max_length=50)    
    Revenue_circle = models.CharField(max_length=50)   
    Sum_Insured = models.FloatField()   
    Area = models.FloatField()
    Farmer = models.IntegerField()
  
  
  def __str__(self):
  
      return self.Fruit
  
  def save(self, *args, **kwargs):
  
      super().save(*args, **kwargs)
  
  class Meta:
  
    verbose_name_plural = 'wbcis'
  
  from models import Wbcis
  Guava =Wbcis.objects.filter(Q(Fruit='Guava'))
  print Guava
  Banana= Wbcis.objects.filter(Q(Fruit='Banana'))
  print Banana  
  Pomegranate= Wbcis.objects.filter(Q(Fruit='Pomegranate'))   
  print Pomegranate
  Guava_Banana=Wbcis.objects.filter(Q(Fruit='Guava')&amp;Q(Fruit='Banana'))   
  print Guava_Banana
  </code></pre>
  
  <p>But, I know this is not correct way for query.
  I need to write this in for loop or while loop.
  can you please help me for how to writing this query using for loop ?</p>