From: jlaine Date: Tue, 1 Jun 2010 12:59:46 +0000 (+0000) Subject: restrict selected fields X-Git-Url: https://git.stderr.nl/gitweb?a=commitdiff_plain;h=f581bcb796907a374dc1210044600fb5792f6dfe;p=matthijs%2Fupstream%2Fdjango-ldapdb.git restrict selected fields git-svn-id: https://svn.bolloretelecom.eu/opensource/django-ldapdb/trunk@916 e071eeec-0327-468d-9b6a-08194a12b294 --- 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'):