[PATCH v2 5/6] REST: Use NumberFilter for event fields

Stephen Finucane stephen at that.guru
Tue Apr 10 07:02:55 AEST 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 stop generating a stupid big '<select>' and require people fill
this in manually.

Signed-off-by: Stephen Finucane <stephen at that.guru>
 patchwork/api/filters.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/patchwork/api/filters.py b/patchwork/api/filters.py
index eed7995d..9a8987e9 100644
--- a/patchwork/api/filters.py
+++ b/patchwork/api/filters.py
@@ -22,6 +22,7 @@ from django.core.exceptions import ValidationError
 from django_filters import FilterSet
 from django_filters import IsoDateTimeFilter
 from django_filters import ModelChoiceFilter
+from django_filters import NumberFilter
 from django.forms import ModelChoiceField
 from patchwork.models import Bundle
@@ -178,6 +179,10 @@ class CheckFilter(TimestampMixin, FilterSet):
 class EventFilter(ProjectMixin, TimestampMixin, FilterSet):
+    patch = NumberFilter()
+    series = NumberFilter()
+    cover = NumberFilter()
     class Meta:
         model = Event
         fields = ('project', 'category', 'series', 'patch', 'cover')

More information about the Patchwork mailing list