summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Finucane <stephen@that.guru>2021-02-24 15:08:45 +0000
committerStephen Finucane <stephen@that.guru>2021-02-24 15:08:45 +0000
commit79700f321335a2d7c649eb03932797af521942a0 (patch)
tree989729f420e6cf5c916df7fb4913956ba4ab4121
parent5a2f429debd549aac457006a51d50cca88405ab9 (diff)
downloadpatchwork-79700f321335a2d7c649eb03932797af521942a0.tar
patchwork-79700f321335a2d7c649eb03932797af521942a0.tar.gz
api: do not fetch every patch in a patch detail view 404 (v2)
Commit 08c5856 fixed an issue whereby a 404 on the aforementioned URL could result in a large DB query due to DRF attempting to populate the 'related' list box with all patches on the instance. That was accidentally reverted in commit fe07f30. "Unrevert" this change. Signed-off-by: Stephen Finucane <stephen@that.guru> Fixes: fe07f30 ("Remove 'PatchRelationSerializer'") Closes: #397
-rw-r--r--patchwork/api/patch.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/patchwork/api/patch.py b/patchwork/api/patch.py
index f6cb276..9d22275 100644
--- a/patchwork/api/patch.py
+++ b/patchwork/api/patch.py
@@ -84,7 +84,8 @@ class PatchListSerializer(BaseHyperlinkedModelSerializer):
checks = SerializerMethodField()
tags = SerializerMethodField()
related = PatchSerializer(
- source='related.patches', many=True, default=[])
+ source='related.patches', many=True, default=[],
+ style={'base_template': 'input.html'})
def get_web_url(self, instance):
request = self.context.get('request')