support case insensitive "contains"
authorjlaine <jlaine@e071eeec-0327-468d-9b6a-08194a12b294>
Mon, 24 May 2010 17:57:12 +0000 (17:57 +0000)
committerjlaine <jlaine@e071eeec-0327-468d-9b6a-08194a12b294>
Mon, 24 May 2010 17:57:12 +0000 (17:57 +0000)
git-svn-id: https://svn.bolloretelecom.eu/opensource/django-ldapdb/trunk@873 e071eeec-0327-468d-9b6a-08194a12b294

ldapdb/models/fields.py

index 5e85062407847b2a7735ec0b83eece3c38c7a427..e074a6a7b51dfbacf274af488e3b8d334a422662 100644 (file)
@@ -33,7 +33,7 @@ class CharField(fields.CharField):
             return ["*%s" % escape_ldap_filter(value)]
         elif lookup_type == 'startswith':
             return ["%s*" % escape_ldap_filter(value)]
-        elif lookup_type == 'contains':
+        elif lookup_type in ['contains', 'icontains']:
             return ["*%s*" % escape_ldap_filter(value)]
         elif lookup_type == 'exact':
             return [escape_ldap_filter(value)]
@@ -48,7 +48,7 @@ class CharField(fields.CharField):
             return "*%s" % escape_ldap_filter(value)
         elif lookup_type == 'startswith':
             return "%s*" % escape_ldap_filter(value)
-        elif lookup_type == 'contains':
+        elif lookup_type in ['contains', 'icontains']:
             return "*%s*" % escape_ldap_filter(value)
         elif lookup_type == 'exact':
             return escape_ldap_filter(value)