Skip to content

Commit

Permalink
perf: improve efficiency of ORM call (#1975)
Browse files Browse the repository at this point in the history
  • Loading branch information
code-review-doctor committed May 27, 2021
1 parent 30bba1f commit 5259e1f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mezzanine/core/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ def save_model(self, request, obj, form, change):
super(SitePermissionUserAdmin, self).save_model(request, obj, form, change)
user = self.model.objects.get(id=obj.id)
has_perms = len(user.get_all_permissions()) > 0
has_sites = SitePermission.objects.filter(user=user).count() > 0
has_sites = SitePermission.objects.filter(user=user).exists()
if (
user.is_active
and user.is_staff
Expand Down

0 comments on commit 5259e1f

Please sign in to comment.