Skip to content

Commit

Permalink
Merge pull request #1 from robthehall/master
Browse files Browse the repository at this point in the history
I've fixed the admin file to filter using the actual default manager, rather than rely on the conventional "objects".
  • Loading branch information
coddingtonbear committed May 16, 2011
2 parents a6ee0eb + 3c30e4e commit a52f873
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions multisite/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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":
Expand All @@ -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
Expand Down

0 comments on commit a52f873

Please sign in to comment.