# meta-data
base_dn = None
+ search_scope = ldap.SCOPE_SUBTREE
object_classes = ['top']
def __init__(self, *args, **kwargs):
super(Model, self).__init__(*args, **kwargs)
self.saved_pk = self.pk
- def _collect_sub_objects(self, collector):
+ def _collect_sub_objects(self, seen_objs, parent=None, nullable=False):
"""
This private API seems to be called by the admin interface in django 1.2
"""
- pass
+ pk_val = self._get_pk_val()
+ seen_objs.add(self.__class__, pk_val, self,
+ type(parent), parent, nullable)
def build_rdn(self):
"""
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")
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)
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)