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

Message ID 20180409210256.19649-6-stephen@that.guru
State New
Headers show
Series
  • Add 'Event.payload' field
Related show

Commit Message

Stephen Finucane April 9, 2018, 9:02 p.m.
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@that.guru>
---
 patchwork/api/filters.py | 5 +++++
 1 file changed, 5 insertions(+)

Patch

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')