Check out https://code.djangoproject.com/ticket/9682. Apparently this is a
mysql specific thing.
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to
This workaround works.
In [10]: from django.db.models.functions import Lower
In [11]: from django.db.models import CharField
In [12]: CharField.register_lookup(Lower, "lower")
Out[12]: django.db.models.functions.base.Lower
In [13]: doctor.objects.filter(name__lower__contains="joel")
Out[13]: ,
This is what I got:
In [8]: doct = doctor.objects.filter(name__icontains = 'joel')
...: print(doct.query)
SELECT `appointments_doctor`.`docid`, `appointments_doctor`.`name`,
`appointments_doctor`.`username`, `appointments_doctor`.`regid`,
`appointments_doctor`.`photo`,
The only reasonable explanation is Django sees only upper case inputs as
being case sensitive .so inputting a lower case and specifying icontains
wouldnt change anything .you could get your input from a form to confirm
On Fri., 10 Aug. 2018, 18:06 Joel, wrote:
> I'm trying to do a case
Are you using sqlite for your db? if so, there are some notes about case
insensitive matching at
https://docs.djangoproject.com/en/dev/ref/databases/#sqlite-string-matching
otherwise, I'd be interested in seeing what your SQL is like
in your django shell, do the following:
doctors =
I’m fascinated by this problem.
Try this workaround.
https://docs.djangoproject.com/en/2.0/ref/models/database-functions/#lower
Register the lookup Lower like so:
CharField.register_lookup(Lower, "lower")
Then use the contains lookup.
doctor.objects.filter(name__lower__contains="joel")
From:
6 matches
Mail list logo