Hi Jorgue,
As you already know there's no officially supported API to create custom lookups in Django < 1.7
However it's possible to get something working by monkey patching WhereNode.make_atom.
Here's
an example GIST that expose a decent API to add custom lookups.
From importing the lookups module you should be able to register your custom lookup this way:
def db_prepare_customcomparison(value, connection, prepared):
return [value.replace(' ', '').lower()]
lookups.register(
'customcomparison',
'replace(lower(%s), " ", "") = %%s',
db_prepare=db_prepare_customcomparison,
)
Note that you should use this code at your own risk since it's messing with Django's internal and I would strongly advise you to move to 1.7 instead since 1.6 is approaching end of support.
Simon