Skip to content

Commit

Permalink
OKRS24-235 Added eager loading to reduce number of database calls.
Browse files Browse the repository at this point in the history
  • Loading branch information
dmytrotsko committed Jun 27, 2024
1 parent d9f8da6 commit 77c5a3f
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/signals/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,17 @@ def get_context_data(self, **kwargs) -> Dict[str, Any]:
context["url_params_str"] = url_params_str
context["filter"] = SignalFilter(self.request.GET, queryset=self.get_queryset())

context["signals"] = self.get_queryset()
context["signals"] = self.get_queryset().prefetch_related(
"pathogen",
"available_geography",
"geographic_scope",
"source",
).select_related(
"base",
"signal_type",
"category",
"license"
)
return context


Expand Down

0 comments on commit 77c5a3f

Please sign in to comment.