diff options
author | Christopher Long <indirecthit@gmail.com> | 2006-09-18 14:21:47 +0000 |
---|---|---|
committer | Christopher Long <indirecthit@gmail.com> | 2006-09-18 14:21:47 +0000 |
commit | aa6725cb07049fa2dd6da1a8f7923ae74a851d96 (patch) | |
tree | 6ec26459104891b7ea8de1bd0749a0abe088ea28 | |
parent | 20ca1751dc8bbd01dd08ed33744298828a519ac1 (diff) | |
download | django-aa6725cb07049fa2dd6da1a8f7923ae74a851d96.tar.gz |
[per-object-permissions] Fixes another problem when using one-to-one relations and POPs
git-svn-id: http://code.djangoproject.com/svn/django/branches/per-object-permissions@3769 bcc190cf-cafb-0310-a4f2-bffc1f526a37
-rw-r--r-- | django/contrib/admin/views/main.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/django/contrib/admin/views/main.py b/django/contrib/admin/views/main.py index dab5270d6f..f387de60df 100644 --- a/django/contrib/admin/views/main.py +++ b/django/contrib/admin/views/main.py @@ -692,9 +692,12 @@ class ChangeList(object): def get_query_set(self): if (not self.opts.admin.show_all_rows) and self.opts.row_level_permissions and (not self.user.has_perm(self.opts.app_label + "."+self.opts.get_change_permission())): from django.contrib.auth.models import RowLevelPermission - qs = self.manager.filter(id__in=RowLevelPermission.objects.get_model_list(self.user, + model_id_name = self.opts.pk.attname + param_name = model_id_name.replace("_", "__")+"__in" + param = {param_name:RowLevelPermission.objects.get_model_list(self.user, self.model, - self.opts.get_change_permission())) + self.opts.get_change_permission())} + qs = self.manager.filter(**param) else: qs = self.manager.get_query_set() lookup_params = self.params.copy() # a dictionary of the query string |