Permalink
Browse files

Check against already computed var instead of F. Fixes #98

  • Loading branch information...
1 parent 6532dce commit c52fff1df2133e7817f9f4fa38e92cfc4f30c677 @lukaszb lukaszb committed Feb 11, 2013
Showing with 3 additions and 3 deletions.
  1. +3 −3 guardian/core.py
View
@@ -68,18 +68,18 @@ def get_perms(self, obj):
perms = list(set(chain(*Permission.objects
.filter(content_type=ctype)
.filter(
- Q(userobjectpermission__content_type=F('content_type'),
+ Q(userobjectpermission__content_type=ctype,
userobjectpermission__user=self.user,
userobjectpermission__object_pk=obj.pk) |
- Q(groupobjectpermission__content_type=F('content_type'),
+ Q(groupobjectpermission__content_type=ctype,
groupobjectpermission__group__user=self.user,
groupobjectpermission__object_pk=obj.pk))
.values_list("codename"))))
else:
perms = list(set(chain(*Permission.objects
.filter(content_type=ctype)
.filter(
- groupobjectpermission__content_type=F('content_type'),
+ groupobjectpermission__content_type=ctype,
groupobjectpermission__group=self.group,
groupobjectpermission__object_pk=obj.pk)
.values_list("codename"))))

0 comments on commit c52fff1

Please sign in to comment.