Source

django-mongodb / django_mongodb / query.py

Diff from to

django_mongodb/query.py

             field_name = lvalue[1]
             if field_name == pk_field.name:
                 field_name = "_id"
-                if isinstance(pk_field, models.AutoField):
-                    params = [isinstance(par, ObjectId) and par or ObjectId.url_decode(par) for par in params]
+                if isinstance(pk_field, models.AutoField):                            
+                    params = [isinstance(par, str) and ObjectId.url_decode(par) or par for par in params]
             if lookup_type == "exact":
                 if parent_negated:
                     res = {field_name: {"$ne": params[0]}}
                 else:
                     res = {field_name: params[0]}
+            elif lookup_type == "iexact":
+                par_re = re.compile("^%s$" % re.escape(params[0]), re.I)
+                if parent_negated:
+                    res = {field_name: {"$ne": par_re}}
+                else:
+                    res = {field_name: par_re}
             elif lookup_type == "gt":
                 res = {field_name:{parent_negated and "$lte" or "$gt":params[0]}}
             elif lookup_type == "gte":