From 20e2c869ddee0fc85878c94c60512040b5c563ab Mon Sep 17 00:00:00 2001 From: jlaine Date: Fri, 14 Aug 2009 15:34:56 +0000 Subject: [PATCH] rework passing of dn git-svn-id: https://svn.bolloretelecom.eu/opensource/django-ldapdb/trunk@474 e071eeec-0327-468d-9b6a-08194a12b294 --- ldapdb/models/base.py | 5 +++-- ldapdb/models/query.py | 7 +++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/ldapdb/models/base.py b/ldapdb/models/base.py index 8ff0c7a..1e47a53 100644 --- a/ldapdb/models/base.py +++ b/ldapdb/models/base.py @@ -56,8 +56,9 @@ class Model(django.db.models.base.Model): """ __metaclass__ = ModelBase - def __init__(self, dn=None, *args, **kwargs): - self.dn = dn + dn = django.db.models.fields.CharField(max_length=200) + + def __init__(self, *args, **kwargs): super(Model, self).__init__(*args, **kwargs) self.saved_pk = self.pk diff --git a/ldapdb/models/query.py b/ldapdb/models/query.py index e79a8bc..b53d959 100644 --- a/ldapdb/models/query.py +++ b/ldapdb/models/query.py @@ -91,9 +91,12 @@ class Query(BaseQuery): # process results for dn, attrs in vals: - row = [dn] + row = [] for field in iter(self.model._meta.fields): - row.append(attrs.get(field.db_column, None)) + if field.attname == 'dn': + row.append(dn) + else: + row.append(attrs.get(field.db_column, None)) yield row class QuerySet(BaseQuerySet): -- 2.30.2