title: Case insensitive search in django for mysql
body: <p>I'm trying to do a case insensitive search for a substring within a field in my model.</p>
  
  <p>My model:</p>
  
  <pre><code>class doctor(models.Model):
      docid = models.AutoField(primary_key=True, unique=True) # Need autoincrement, unique and primary
      name = models.CharField(max_length=35)
      username = models.CharField(max_length=15)
      regid = models.CharField(max_length=15, default="", blank=True)
      photo = models.CharField(
          max_length=35, default="", blank=True)
      email = models.EmailField(default="", blank=True)
      phone = models.CharField(max_length=15)
      qualifications = models.CharField(
          max_length=50, default="", blank=True)
      about = models.CharField(
          max_length=35, default="", blank=True)
      specialities = models.CharField(
          max_length=50, default="", blank=True)
      department = models.CharField(max_length=50, default="ENT", blank=True)
      fees = models.FloatField(default=300.0)
      displayfee = models.IntegerField(default=0, blank=True)
      slotrange = models.CharField(max_length=50, blank=True)
      slotdurn = models.IntegerField(default=10)
      breakrange = models.CharField(
          max_length=50, default="", blank=True)
      slotsleft = models.CharField(
          max_length=50, default="", blank=True)
      def __str__(self):
          return self.name
      def Range(self):
          return self.slotrange
      def listslots(self):
          SlotRange = self.slotrange
          SlotDurn = self.slotdurn
          startime = SlotRange.split('-')[0]
          endtime = SlotRange.split('-')[1]
          sthr, stmin = SplitTimeString(startime)
          enhr, enmin = SplitTimeString(endtime)
          print(stamptoday(sthr, stmin))
          print(stamptoday(enhr, enmin))
          startstamp = stamptoday(sthr, stmin)
          endstamp = stamptoday(enhr, enmin)
          secdurn = SlotDurn*60
          slotlist = []
          for sec in range(startstamp, endstamp, secdurn):
              enttime = sec + secdurn
              myrange = ("%s - %s" % (HumanTime(sec),
                                      HumanTime(enttime)))
              slotlist.append(myrange)
          return slotlist
  </code></pre>
  
  <p>Under the field 'name' in my mysql database, are two rows with values for name as 'Joel' and 'Jaffy Joel'.</p>
  
  <p>When I do the search like this:</p>
  
  <pre><code>from appointments.models import customer, doctor, appointment
  doctor.objects.filter(name__icontains='joel')
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>&lt;QuerySet []&gt;
  </code></pre>
  
  <p>But when I do:</p>
  
  <pre><code>doctor.objects.filter(name__icontains='Joel')
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>&lt;QuerySet [&lt;doctor: Joel&gt;, &lt;doctor: Jaffy Joel&gt;]&gt;
  </code></pre>
  
  <p>Why isnt the case insensitive search working for a lowercase search?</p>