[PATCH 5/7] REST: Rename Filter -> FilterSet

Stephen Finucane stephen at that.guru
Thu Apr 12 02:13:36 AEST 2018


This was confusing and will conflict with some forthcoming changes.

Signed-off-by: Stephen Finucane <stephen at that.guru>
---
 patchwork/api/bundle.py  |  4 ++--
 patchwork/api/check.py   |  4 ++--
 patchwork/api/cover.py   |  4 ++--
 patchwork/api/event.py   |  4 ++--
 patchwork/api/filters.py | 12 ++++++------
 patchwork/api/patch.py   |  4 ++--
 patchwork/api/series.py  |  4 ++--
 7 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/patchwork/api/bundle.py b/patchwork/api/bundle.py
index 0278592a..733e4881 100644
--- a/patchwork/api/bundle.py
+++ b/patchwork/api/bundle.py
@@ -24,7 +24,7 @@ from rest_framework.serializers import HyperlinkedModelSerializer
 from rest_framework.serializers import SerializerMethodField
 
 from patchwork.api.base import PatchworkPermission
-from patchwork.api.filters import BundleFilter
+from patchwork.api.filters import BundleFilterSet
 from patchwork.api.embedded import PatchSerializer
 from patchwork.api.embedded import ProjectSerializer
 from patchwork.api.embedded import UserSerializer
@@ -73,7 +73,7 @@ class BundleMixin(object):
 class BundleList(BundleMixin, ListAPIView):
     """List bundles."""
 
-    filter_class = BundleFilter
+    filter_class = BundleFilterSet
     search_fields = ('name',)
     ordering_fields = ('id', 'name', 'owner')
     ordering = 'id'
diff --git a/patchwork/api/check.py b/patchwork/api/check.py
index b37d6e01..8753c7de 100644
--- a/patchwork/api/check.py
+++ b/patchwork/api/check.py
@@ -27,7 +27,7 @@ from rest_framework.serializers import HyperlinkedModelSerializer
 from patchwork.api.base import CheckHyperlinkedIdentityField
 from patchwork.api.base import MultipleFieldLookupMixin
 from patchwork.api.embedded import UserSerializer
-from patchwork.api.filters import CheckFilter
+from patchwork.api.filters import CheckFilterSet
 from patchwork.models import Check
 from patchwork.models import Patch
 
@@ -80,7 +80,7 @@ class CheckSerializer(HyperlinkedModelSerializer):
 class CheckMixin(object):
 
     serializer_class = CheckSerializer
-    filter_class = CheckFilter
+    filter_class = CheckFilterSet
 
     def get_queryset(self):
         return Check.objects.prefetch_related('patch', 'user')
diff --git a/patchwork/api/cover.py b/patchwork/api/cover.py
index fc7ae97b..9c9dc738 100644
--- a/patchwork/api/cover.py
+++ b/patchwork/api/cover.py
@@ -24,7 +24,7 @@ from rest_framework.generics import RetrieveAPIView
 from rest_framework.serializers import SerializerMethodField
 
 from patchwork.api.base import BaseHyperlinkedModelSerializer
-from patchwork.api.filters import CoverLetterFilter
+from patchwork.api.filters import CoverLetterFilterSet
 from patchwork.api.embedded import PersonSerializer
 from patchwork.api.embedded import ProjectSerializer
 from patchwork.api.embedded import SeriesSerializer
@@ -74,7 +74,7 @@ class CoverLetterList(ListAPIView):
     """List cover letters."""
 
     serializer_class = CoverLetterListSerializer
-    filter_class = CoverLetterFilter
+    filter_class = CoverLetterFilterSet
     search_fields = ('name',)
     ordering_fields = ('id', 'name', 'date', 'submitter')
     ordering = 'id'
diff --git a/patchwork/api/event.py b/patchwork/api/event.py
index 9879a9f6..b6626ec7 100644
--- a/patchwork/api/event.py
+++ b/patchwork/api/event.py
@@ -32,7 +32,7 @@ from patchwork.api.embedded import PatchSerializer
 from patchwork.api.embedded import ProjectSerializer
 from patchwork.api.embedded import SeriesSerializer
 from patchwork.api.embedded import UserSerializer
-from patchwork.api.filters import EventFilter
+from patchwork.api.filters import EventFilterSet
 from patchwork.api.patch import StateField
 from patchwork.models import Event
 
@@ -104,7 +104,7 @@ class EventList(ListAPIView):
     renderer_classes = (JSONRenderer, JSONListHTMLRenderer)
     template_name = 'patchwork/event-list.html'
     serializer_class = EventSerializer
-    filter_class = EventFilter
+    filter_class = EventFilterSet
     page_size_query_param = None  # fixed page size
     ordering_fields = ()
     ordering = '-date'
diff --git a/patchwork/api/filters.py b/patchwork/api/filters.py
index 7d94d5ed..afef10f4 100644
--- a/patchwork/api/filters.py
+++ b/patchwork/api/filters.py
@@ -141,7 +141,7 @@ class TimestampMixin(FilterSet):
     since = IsoDateTimeFilter(name='date', lookup_expr='gte')
 
 
-class SeriesFilter(TimestampMixin, FilterSet):
+class SeriesFilterSet(TimestampMixin, FilterSet):
 
     submitter = PersonFilter(queryset=Person.objects.all())
     project = ProjectFilter(queryset=Project.objects.all())
@@ -151,7 +151,7 @@ class SeriesFilter(TimestampMixin, FilterSet):
         fields = ('submitter', 'project')
 
 
-class CoverLetterFilter(TimestampMixin, FilterSet):
+class CoverLetterFilterSet(TimestampMixin, FilterSet):
 
     project = ProjectFilter(queryset=Project.objects.all())
     submitter = PersonFilter(queryset=Person.objects.all())
@@ -161,7 +161,7 @@ class CoverLetterFilter(TimestampMixin, FilterSet):
         fields = ('project', 'series', 'submitter')
 
 
-class PatchFilter(TimestampMixin, FilterSet):
+class PatchFilterSet(TimestampMixin, FilterSet):
 
     project = ProjectFilter(queryset=Project.objects.all())
     submitter = PersonFilter(queryset=Person.objects.all())
@@ -174,7 +174,7 @@ class PatchFilter(TimestampMixin, FilterSet):
                   'state', 'archived')
 
 
-class CheckFilter(TimestampMixin, FilterSet):
+class CheckFilterSet(TimestampMixin, FilterSet):
 
     user = UserFilter(queryset=User.objects.all())
 
@@ -183,7 +183,7 @@ class CheckFilter(TimestampMixin, FilterSet):
         fields = ('user', 'state', 'context')
 
 
-class EventFilter(TimestampMixin, FilterSet):
+class EventFilterSet(TimestampMixin, FilterSet):
 
     project = ProjectFilter(queryset=Project.objects.all())
 
@@ -192,7 +192,7 @@ class EventFilter(TimestampMixin, FilterSet):
         fields = ('project', 'category', 'series', 'patch', 'cover')
 
 
-class BundleFilter(FilterSet):
+class BundleFilterSet(FilterSet):
 
     project = ProjectFilter(queryset=Project.objects.all())
     owner = UserFilter(queryset=User.objects.all())
diff --git a/patchwork/api/patch.py b/patchwork/api/patch.py
index 115feffa..eee3818e 100644
--- a/patchwork/api/patch.py
+++ b/patchwork/api/patch.py
@@ -28,7 +28,7 @@ from rest_framework.serializers import HyperlinkedModelSerializer
 from rest_framework.serializers import SerializerMethodField
 
 from patchwork.api.base import PatchworkPermission
-from patchwork.api.filters import PatchFilter
+from patchwork.api.filters import PatchFilterSet
 from patchwork.api.embedded import PersonSerializer
 from patchwork.api.embedded import ProjectSerializer
 from patchwork.api.embedded import SeriesSerializer
@@ -143,7 +143,7 @@ class PatchList(ListAPIView):
 
     permission_classes = (PatchworkPermission,)
     serializer_class = PatchListSerializer
-    filter_class = PatchFilter
+    filter_class = PatchFilterSet
     search_fields = ('name',)
     ordering_fields = ('id', 'name', 'project', 'date', 'state', 'archived',
                        'submitter', 'check')
diff --git a/patchwork/api/series.py b/patchwork/api/series.py
index b5f4450a..ab1b6adb 100644
--- a/patchwork/api/series.py
+++ b/patchwork/api/series.py
@@ -23,7 +23,7 @@ from rest_framework.serializers import HyperlinkedModelSerializer
 from rest_framework.serializers import SerializerMethodField
 
 from patchwork.api.base import PatchworkPermission
-from patchwork.api.filters import SeriesFilter
+from patchwork.api.filters import SeriesFilterSet
 from patchwork.api.embedded import CoverLetterSerializer
 from patchwork.api.embedded import PatchSerializer
 from patchwork.api.embedded import PersonSerializer
@@ -68,7 +68,7 @@ class SeriesMixin(object):
 class SeriesList(SeriesMixin, ListAPIView):
     """List series."""
 
-    filter_class = SeriesFilter
+    filter_class = SeriesFilterSet
     search_fields = ('name',)
     ordering_fields = ('id', 'name', 'date', 'submitter', 'received_all')
     ordering = 'id'
-- 
2.14.3



More information about the Patchwork mailing list