Skip to content

Commit

Permalink
Check against already computed var instead of F. Fixes #98
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaszb committed Feb 11, 2013
1 parent 6532dce commit c52fff1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions guardian/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"))))
Expand Down

0 comments on commit c52fff1

Please sign in to comment.