From 82901736cde9aae9fbe8b6acc0aad2141ecd9583 Mon Sep 17 00:00:00 2001 From: jlaine Date: Mon, 31 May 2010 18:28:59 +0000 Subject: [PATCH] fix ordering on int fields git-svn-id: https://svn.bolloretelecom.eu/opensource/django-ldapdb/trunk@902 e071eeec-0327-468d-9b6a-08194a12b294 --- ldapdb/models/query.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/ldapdb/models/query.py b/ldapdb/models/query.py index d0958b1..bbb46e2 100644 --- a/ldapdb/models/query.py +++ b/ldapdb/models/query.py @@ -103,8 +103,13 @@ class Compiler(object): else: negate = False field = query.model._meta.get_field(fieldname) - attr_x = field.from_ldap(x[1].get(field.db_column, []), connection=self.connection).lower() - attr_y = field.from_ldap(y[1].get(field.db_column, []), connection=self.connection).lower() + attr_x = field.from_ldap(x[1].get(field.db_column, []), connection=self.connection) + attr_y = field.from_ldap(y[1].get(field.db_column, []), connection=self.connection) + # perform case insensitive comparison + if hasattr(attr_x, 'lower'): + attr_x = attr_x.lower() + if hasattr(attr_y, 'lower'): + attr_y = attr_y.lower() val = negate and cmp(attr_y, attr_x) or cmp(attr_x, attr_y) if val: return val -- 2.30.2