diff --git a/patchwork/api/series.py b/patchwork/api/series.py index ec335476..36d22895 100644 --- a/patchwork/api/series.py +++ b/patchwork/api/series.py @@ -95,7 +95,11 @@ class SeriesMixin(object): def get_queryset(self): return ( Series.objects.all() - .prefetch_related('patches__project', 'cover_letter__project') + .prefetch_related( + 'patches__project', + 'cover_letter__project', + 'related_series__project', + ) .select_related('submitter', 'project') ) diff --git a/patchwork/tests/api/test_series.py b/patchwork/tests/api/test_series.py index 730678a8..597b61a9 100644 --- a/patchwork/tests/api/test_series.py +++ b/patchwork/tests/api/test_series.py @@ -152,7 +152,7 @@ def test_list_bug_335(self): create_cover(series=series_obj) create_patch(series=series_obj) - with self.assertNumQueries(6): + with self.assertNumQueries(7): self.client.get(self.api_url()) @utils.store_samples('series-detail')