Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Michael <michael-k@users.noreply.github.com>
  • Loading branch information
2 people authored and ad-m committed Aug 4, 2020
1 parent 753c13e commit ee8200a
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions guardian/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,7 @@ def get_perms(self, obj):
return []
if self.user and self.user.is_superuser:
perms = list(
chain.from_iterable(
Permission.objects.filter(content_type=ctype).values_list("codename")
)
Permission.objects.filter(content_type=ctype).values_list("codename", flat=True)
)
elif self.user:
# Query user and group permissions separately and then combine
Expand Down Expand Up @@ -195,9 +193,7 @@ def prefetch_perms(self, objects):

if self.user and self.user.is_superuser:
perms = list(
chain.from_iterable(
Permission.objects.filter(content_type=ctype).values_list("codename")
)
Permission.objects.filter(content_type=ctype).values_list("codename", flat=True)
)

for pk in pks:
Expand Down

0 comments on commit ee8200a

Please sign in to comment.