[PATCH 4/7] REST: Remove ProjectFilterMixin
Daniel Axtens
dja at axtens.net
Wed May 9 01:47:44 AEST 2018
Stephen Finucane <stephen at that.guru> writes:
> Whatever benefits this was giving us in the past are no more and it
> simply confuses matters now.
I strongly endorse the removal of this mixin in particular (and most
mixins, in general).
Reviewed-by: Daniel Axtens <dja at axtens.net>
Regards,
Daniel
>
> Signed-off-by: Stephen Finucane <stephen at that.guru>
> ---
> patchwork/api/filters.py | 21 +++++++++++----------
> 1 file changed, 11 insertions(+), 10 deletions(-)
>
> diff --git a/patchwork/api/filters.py b/patchwork/api/filters.py
> index b30499d0..7d94d5ed 100644
> --- a/patchwork/api/filters.py
> +++ b/patchwork/api/filters.py
> @@ -141,22 +141,19 @@ class TimestampMixin(FilterSet):
> since = IsoDateTimeFilter(name='date', lookup_expr='gte')
>
>
> -class ProjectMixin(FilterSet):
> -
> - project = ProjectFilter(queryset=Project.objects.all())
> -
> -
> -class SeriesFilter(ProjectMixin, TimestampMixin, FilterSet):
> +class SeriesFilter(TimestampMixin, FilterSet):
>
> submitter = PersonFilter(queryset=Person.objects.all())
> + project = ProjectFilter(queryset=Project.objects.all())
>
> class Meta:
> model = Series
> fields = ('submitter', 'project')
>
>
> -class CoverLetterFilter(ProjectMixin, TimestampMixin, FilterSet):
> +class CoverLetterFilter(TimestampMixin, FilterSet):
>
> + project = ProjectFilter(queryset=Project.objects.all())
> submitter = PersonFilter(queryset=Person.objects.all())
>
> class Meta:
> @@ -164,8 +161,9 @@ class CoverLetterFilter(ProjectMixin, TimestampMixin, FilterSet):
> fields = ('project', 'series', 'submitter')
>
>
> -class PatchFilter(ProjectMixin, TimestampMixin, FilterSet):
> +class PatchFilter(TimestampMixin, FilterSet):
>
> + project = ProjectFilter(queryset=Project.objects.all())
> submitter = PersonFilter(queryset=Person.objects.all())
> delegate = UserFilter(queryset=User.objects.all())
> state = StateFilter(queryset=State.objects.all())
> @@ -185,15 +183,18 @@ class CheckFilter(TimestampMixin, FilterSet):
> fields = ('user', 'state', 'context')
>
>
> -class EventFilter(ProjectMixin, TimestampMixin, FilterSet):
> +class EventFilter(TimestampMixin, FilterSet):
> +
> + project = ProjectFilter(queryset=Project.objects.all())
>
> class Meta:
> model = Event
> fields = ('project', 'category', 'series', 'patch', 'cover')
>
>
> -class BundleFilter(ProjectMixin, FilterSet):
> +class BundleFilter(FilterSet):
>
> + project = ProjectFilter(queryset=Project.objects.all())
> owner = UserFilter(queryset=User.objects.all())
>
> class Meta:
> --
> 2.14.3
>
> _______________________________________________
> Patchwork mailing list
> Patchwork at lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/patchwork
More information about the Patchwork
mailing list