Reputation: 133
I'm using Django and Python
unicode_countries = request.POST.getlist(u'countries')
Returns [u'ai', u'ag', u'aw', u'bs']
My goals it to convert unicode_countries to MySQL IN string, which should look like 'ai', 'ag', 'aw', 'bs' which I will use in a MySQL statement as "WHERE countries in ('ai', 'ag', 'aw', 'bs')"
Please help.
Upvotes: 0
Views: 212
Reputation: 599610
No conversion needed.
MyModel.objects.filter(countries__in=unicode_countries)
Upvotes: 1