diff --git a/patchwork/api/series.py b/patchwork/api/series.py index ab44ee70..0c22b3c1 100644 --- a/patchwork/api/series.py +++ b/patchwork/api/series.py @@ -98,7 +98,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')