From f581bcb796907a374dc1210044600fb5792f6dfe Mon Sep 17 00:00:00 2001 From: jlaine Date: Tue, 1 Jun 2010 12:59:46 +0000 Subject: [PATCH] restrict selected fields git-svn-id: https://svn.bolloretelecom.eu/opensource/django-ldapdb/trunk@916 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 e422630..e55c161 100644 --- a/ldapdb/models/query.py +++ b/ldapdb/models/query.py @@ -71,7 +71,12 @@ class Compiler(object): def results_iter(self): query = self.query - attrlist = [ x.db_column for x in query.model._meta.local_fields if x.db_column ] + if self.query.select_fields: + fields = self.query.select_fields + else: + fields = self.query.model._meta.fields + + attrlist = [ x.db_column for x in fields if x.db_column ] try: vals = self.connection.search_s( @@ -123,7 +128,7 @@ class Compiler(object): pos += 1 continue row = [] - for field in iter(query.model._meta.fields): + for field in iter(fields): if field.attname == 'dn': row.append(dn) elif hasattr(field, 'from_ldap'): -- 2.30.2