Icons in Django QuerySet not giving case-insensitive result?

I am using Django1.6, I am trying to use the QuerySet filter, but it behaves strangely.

Here is my code:

test_listing = Test.objects.filter(site__id=_site_id, show_on_site=True)

Then I try to get a listing based on the text found:

test_listing = test_listing.filter(name__icontains = searched_text)

I use MySQL as a database for my project.

When I search for "foo", it returns an empty list, but when I search for "FOO", it returns a list of objects that have a FOOBAR entry as the name in my test table.

Why is this so strange ...?

+4
source share
1 answer

- mysql-db, , , () db SQL-

ALTER TABLE t1 MODIFY
    col1 VARCHAR(5)
      CHARACTER SET latin1
      COLLATE latin1_swedish_ci;
+11

Source: https://habr.com/ru/post/1527874/


All Articles