Skip to content

Commit

Permalink
Fix projects by reporting_ns n+1 queries
Browse files Browse the repository at this point in the history
  • Loading branch information
szabozoltan69 committed Jun 30, 2024
1 parent b5befdd commit aef6d58
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion deployments/drf_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,15 @@ class ProjectViewset(
Project.objects.select_related(
"user", "modified_by", "project_country", "reporting_ns", "dtype", "regional_project", "primary_sector"
)
.prefetch_related("project_districts", "event", "annual_splits", "secondary_sectors", "project_admin2")
.prefetch_related(
"project_districts",
"event",
"event__appeals",
"event__countries_for_preview",
"annual_splits",
"secondary_sectors",
"project_admin2",
)
.order_by("-modified_at")
.all()
)
Expand Down

0 comments on commit aef6d58

Please sign in to comment.