From: jlaine Date: Wed, 2 Jun 2010 15:51:08 +0000 (+0000) Subject: use inherited fields too X-Git-Url: https://git.stderr.nl/gitweb?a=commitdiff_plain;h=41cdb050caa62c61ae209abe759e6879c28ca689;p=matthijs%2Fupstream%2Fdjango-ldapdb.git use inherited fields too git-svn-id: https://svn.bolloretelecom.eu/opensource/django-ldapdb/trunk@927 e071eeec-0327-468d-9b6a-08194a12b294 --- diff --git a/ldapdb/models/base.py b/ldapdb/models/base.py index e98133b..f0ed746 100644 --- a/ldapdb/models/base.py +++ b/ldapdb/models/base.py @@ -85,8 +85,8 @@ class Model(django.db.models.base.Model): Build the Relative Distinguished Name for this entry. """ bits = [] - for field in self._meta.local_fields: - if field.primary_key: + for field in self._meta.fields: + if field.db_column and field.primary_key: bits.append("%s=%s" % (field.db_column, getattr(self, field.name))) if not len(bits): raise Exception("Could not build Distinguished Name") @@ -114,7 +114,7 @@ class Model(django.db.models.base.Model): entry = [('objectClass', self.object_classes)] new_dn = self.build_dn() - for field in self._meta.local_fields: + for field in self._meta.fields: if not field.db_column: continue value = getattr(self, field.name) @@ -132,7 +132,7 @@ class Model(django.db.models.base.Model): record_exists = True modlist = [] orig = self.__class__.objects.get(pk=self.saved_pk) - for field in self._meta.local_fields: + for field in self._meta.fields: if not field.db_column: continue old_value = getattr(orig, field.name, None)