Django:icontains的大小写对Unicode敏感 [英] Django: icontains case is sensitive for unicode

查看:100
本文介绍了Django:icontains的大小写对Unicode敏感的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在对我的博客进行简单搜索.我使用亚美尼亚语,搜索时对这些字母总是很敏感.这是我的代码的一部分.预先谢谢你.

I'm making a simple search for my blog. I use an armenian language and when I'm searching it's always sensetive for these letters. Here is a part of my code. Thank you in advance.

search_query = get.get('search')
query_list = search_query.split()
posts = post.objects.filter(
                reduce(operator.and_,
                       (Q(title__icontains=q) for q in query_list))|
                reduce(operator.and_,
                       (Q(content__icontains=q) for q in query_list)),
            )

推荐答案

这通常是SQLite的问题,问题在文档链接中进行了详细描述,还有一个链接可返回原始SQLite网站描述

This is generaly just problem with SQLite, problem is described in details on documentation link, also there is a link getting back to original SQLite site description

从Django 包含文档

SQLite用户

SQLite users

在使用SQLite后端和非ASCII字符串时,请记住关于字符串比较的数据库注释.

When using the SQLite backend and non-ASCII strings, bear in mind the database note about string comparisons.

有关以下问题的SQLite文档

这篇关于Django:icontains的大小写对Unicode敏感的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆