Skip to content

Commit

Permalink
simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshFerge committed Dec 13, 2024
1 parent 14b6274 commit e23fefc
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/sentry/models/projectteam.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from typing import TYPE_CHECKING, ClassVar

from django.db import router, transaction
from django.db.models import QuerySet, prefetch_related_objects
from django.db.models import QuerySet
from django.db.models.signals import post_delete, post_save

from sentry.backup.scopes import RelocationScope
Expand All @@ -16,14 +16,12 @@

class ProjectTeamManager(BaseManager["ProjectTeam"]):
def get_for_teams_with_org_cache(self, teams: Sequence["Team"]) -> QuerySet["ProjectTeam"]:
project_teams = (
return (
self.filter(team__in=teams, project__status=ObjectStatus.ACTIVE)
.order_by("project__name", "project__slug")
.select_related("project")
.prefetch_related("project__organization")
)
prefetch_related_objects(project_teams, "project__organization")

return project_teams


@region_silo_model
Expand Down

0 comments on commit e23fefc

Please sign in to comment.