Django approximate matching of unicode strings with ascii equivalents

Posted by c on Stack Overflow See other posts from Stack Overflow or by c
Published on 2010-03-19T19:49:17Z Indexed on 2010/03/19 19:51 UTC
Read the original article Hit count: 231

Filed under:
|
|
|
|

I have the following model and instance:

class Bashable(models.Model):
    name = models.CharField(max_length=100)

>>> foo = Bashable.objects.create(name=u"piñata")

Now I want to be able to search for objects, but using ascii characters rather than unicode, something like this:

>>> Bashable.objects.filter(name__lookslike="pinata")

Is there a way in Django to do this sort of approximate string matching, using ascii stand-ins for the unicode characters in the database?

Here is a related question, but for Apple's Core Data.

© Stack Overflow or respective owner

Related posts about django

Related posts about unicode