django - __contains filter doesn't work on mysql, works on local SQLite db -


i have following code snippet:

profiles_list = profile.objects.filter(     company=request.user.company, ) search_query = none search_key = none if request.method == 'post':     search_key = request.post.get('skey')     search_query = request.post.get('squery', none)     profiles_list = profiles_list.filter(         **{'%s__contains' % search_key:search_query}     ) 

on local dev machine sqlite database, if type in search_query, example "owal" returns me record search_key contains "owal", example "kowalski".

i tried on production server mysql , doesn't work. know why?

from django documentation:

sqlite doesn’t support case-sensitive statements; contains acts icontains sqlite. see database note more information.

suggestion: use %s__icontains instead.


Comments