From c0b416804ad34ec33f45451c4bcaa80cf3486d7a Mon Sep 17 00:00:00 2001 From: Stephen Burrows Date: Tue, 5 Apr 2011 17:07:59 -0400 Subject: [PATCH] Updated object deletion to match django 1.3's handling and thus multiple dbs. --- contrib/gilbert/plugins/models.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/contrib/gilbert/plugins/models.py b/contrib/gilbert/plugins/models.py index cf871d5..ee13989 100644 --- a/contrib/gilbert/plugins/models.py +++ b/contrib/gilbert/plugins/models.py @@ -1,6 +1,7 @@ from django.conf import settings from django.contrib.admin.util import lookup_field, label_for_field, display_for_field, NestedObjects from django.core.exceptions import PermissionDenied +from django.db import router from django.db.models import Q from django.db.models.fields.related import ManyToOneRel from django.db.models.fields.files import FieldFile, ImageFieldFile, FileField @@ -378,9 +379,8 @@ class ModelAdmin(Plugin): pks = [pks] objs = [self.model._default_manager.all().get(pk=pk) for pk in pks] - collector = NestedObjects() - - for obj in objs: - obj._collect_sub_objects(collector) + using = router.db_for_write(self.model) + collector = NestedObjects(using=using) + collector.collect(objs) return collector.nested(self.data_serialize_model_instance) \ No newline at end of file -- 2.20.1