Skip to content

Commit

Permalink
Merge pull request #1101 from opengisch/QF-5030-fix-orgs
Browse files Browse the repository at this point in the history
Fix getting the list of available teams per organization
  • Loading branch information
suricactus authored Jan 7, 2025
2 parents 7fb503f + 4545709 commit e62ed6c
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions docker-app/qfieldcloud/core/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,13 @@ def get_members(self, obj):

def get_teams(self, obj: Organization) -> list[str]:
"""Implementation of `SerializerMethodField` for `teams`. Returns list of team names."""
return [
t.teamname
for t in Team.objects.filter(team_organization=obj).values("username")
]
team_qs = (
Team.objects.filter(team_organization=obj)
.select_related("team_organization")
.only("username", "team_organization__username")
)

return [t.teamname for t in team_qs]

def get_avatar_url(self, obj):
return get_avatar_url(obj)
Expand Down

0 comments on commit e62ed6c

Please sign in to comment.