From 3c30e4e5ff1d12f7467dab88b115e8a185bd84d5 Mon Sep 17 00:00:00 2001 From: Robert Hall Date: Mon, 16 May 2011 13:45:37 -0700 Subject: [PATCH] Fixing admin to use "_default_manager", rather than the usual "objects". --- multisite/admin.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/multisite/admin.py b/multisite/admin.py index 7efd0f8..fa1bfe3 100644 --- a/multisite/admin.py +++ b/multisite/admin.py @@ -67,11 +67,11 @@ def handle_multisite_foreign_keys(self, db_field, request, **kwargs): if(not request.user.is_superuser): user_sites = request.user.get_profile().sites.all() if(hasattr(db_field.rel.to, "site")): - kwargs["queryset"] = db_field.rel.to.objects.filter( + kwargs["queryset"] = db_field.rel.to._default_manager.filter( site__in = user_sites ) if(hasattr(db_field.rel.to, "sites")): - kwargs["queryset"] = db_field.rel.to.objects.filter( + kwargs["queryset"] = db_field.rel.to._default_manager.filter( sites__in = user_sites ) if db_field.name == "site" or db_field.name == "sites": @@ -81,7 +81,7 @@ def handle_multisite_foreign_keys(self, db_field, request, **kwargs): qkwargs = { self.multisite_indirect_foreign_key_path[db_field.name]: user_sites } - kwargs["queryset"] = db_field.rel.to.objects.filter( + kwargs["queryset"] = db_field.rel.to._default_manager.filter( **qkwargs ) return kwargs