[PATCH 4/4] REST: Only fetch required fields event filtering
Stephen Finucane
stephen at that.guru
Mon Mar 26 02:17:31 AEDT 2018
The filter widget is pretty dumb, containing a full list of every patch
in the system. We will want to rework this in the future, but for now
just minimize the amount of data we're pulling in.
Signed-off-by: Stephen Finucane <stephen at that.guru>
---
patchwork/api/filters.py | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/patchwork/api/filters.py b/patchwork/api/filters.py
index d207b2b6..ab6d6f55 100644
--- a/patchwork/api/filters.py
+++ b/patchwork/api/filters.py
@@ -174,6 +174,13 @@ class CheckFilter(TimestampMixin, FilterSet):
class EventFilter(ProjectMixin, TimestampMixin, FilterSet):
+ patch = ModelChoiceFilter(queryset=Patch.objects.only('pk', 'name'))
+ series = ModelChoiceFilter(queryset=Series.objects.only('pk', 'name'))
+ cover = ModelChoiceFilter(queryset=CoverLetter.objects.only('pk', 'name'))
+
+ def filter_patch(self, queryset, name, value):
+ return queryset.only('pk', 'name')
+
class Meta:
model = Event
fields = ('project', 'category', 'series', 'patch', 'cover')
--
2.14.3
More information about the Patchwork
mailing list