rework passing of dn
authorjlaine <jlaine@e071eeec-0327-468d-9b6a-08194a12b294>
Fri, 14 Aug 2009 15:34:56 +0000 (15:34 +0000)
committerjlaine <jlaine@e071eeec-0327-468d-9b6a-08194a12b294>
Fri, 14 Aug 2009 15:34:56 +0000 (15:34 +0000)
git-svn-id: https://svn.bolloretelecom.eu/opensource/django-ldapdb/trunk@474 e071eeec-0327-468d-9b6a-08194a12b294

ldapdb/models/base.py
ldapdb/models/query.py

index 8ff0c7a5e296b7a671b757b25abbc46f09ad5f51..1e47a53298da5e9036b95a4fb1e2a0f564231d22 100644 (file)
@@ -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
 
index e79a8bc0b6768e7040222f2e76372b959eb41802..b53d9591d73c54a2a187d92cc74b0fc5949c2c97 100644 (file)
@@ -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):