diff options
| author | Russell Keith-Magee <russell@keith-magee.com> | 2010-02-26 13:17:43 +0000 |
|---|---|---|
| committer | Russell Keith-Magee <russell@keith-magee.com> | 2010-02-26 13:17:43 +0000 |
| commit | e12b3199d0c01694ca6b09add5e0f27cadffc8ad (patch) | |
| tree | 4e5eca74ba0e412830f8a5f51020c623564e4ea5 /django/db/models/base.py | |
| parent | 126ca330e230034081182ec8a4bf1f47260b6cb9 (diff) | |
Fixed #6191, #11296 -- Modified the admin deletion confirmation page to use the same object collection scheme as the actual deletion. This ensures that all objects that may be deleted are actually deleted, and that cyclic display problems are avoided. Thanks to carljm for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12598 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/db/models/base.py')
| -rw-r--r-- | django/db/models/base.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/django/db/models/base.py b/django/db/models/base.py index 4ed402f437..c330b6c085 100644 --- a/django/db/models/base.py +++ b/django/db/models/base.py @@ -549,7 +549,8 @@ class Model(object): (model_class, {pk_val: obj, pk_val: obj, ...}), ...] """ pk_val = self._get_pk_val() - if seen_objs.add(self.__class__, pk_val, self, parent, nullable): + if seen_objs.add(self.__class__, pk_val, self, + type(parent), parent, nullable): return for related in self._meta.get_all_related_objects(): @@ -560,7 +561,7 @@ class Model(object): except ObjectDoesNotExist: pass else: - sub_obj._collect_sub_objects(seen_objs, self.__class__, related.field.null) + sub_obj._collect_sub_objects(seen_objs, self, related.field.null) else: # To make sure we can access all elements, we can't use the # normal manager on the related object. So we work directly @@ -578,7 +579,7 @@ class Model(object): continue delete_qs = rel_descriptor.delete_manager(self).all() for sub_obj in delete_qs: - sub_obj._collect_sub_objects(seen_objs, self.__class__, related.field.null) + sub_obj._collect_sub_objects(seen_objs, self, related.field.null) # Handle any ancestors (for the model-inheritance case). We do this by # traversing to the most remote parent classes -- those with no parents |
