Skip to content

Commit

Permalink
Optimering af koden, brug exists() i stedet for count()
Browse files Browse the repository at this point in the history
  • Loading branch information
rasmusselsmark committed Sep 24, 2023
1 parent 386a891 commit 2506390
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions members/admin/activityinvite_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,10 +247,9 @@ def person_link(self, item):
person_link.admin_order_field = "person__name"

def participating(self, item):
return (
item.person.activityparticipant_set.filter(activity=item.activity).count()
> 0
)
return item.person.activityparticipant_set.filter(
activity=item.activity
).exists()

participating.short_description = "Deltager"
participating.boolean = True

0 comments on commit 2506390

Please sign in to comment.