[RFC 1/2] REST: Integrate django-filter support
Andrew Donnellan
andrew.donnellan at au1.ibm.com
Mon Nov 21 13:56:32 AEDT 2016
On 17/11/16 12:47, Stephen Finucane wrote:
> This mostly works out of the box, thanks to Django REST Framework.
> Mostly unique fields, like name or email, are excluded as these will be
> handled separately.
>
> Signed-off-by: Stephen Finucane <stephen at that.guru>
> ---
> I need to disable django-filter support when it's not available.
> However, its use would allow us to get rid of most of 'filters.py'.
> Is this worth introducing a compulsory dependency for?
Hmm...
> +class SeriesFilter(TimestampMixin, FilterSet):
> +
> + class Meta:
> + model = Series
> + fields = ['submitter']
> +
> +
> +class CoverLetterFilter(TimestampMixin, FilterSet):
> +
> + class Meta:
> + model = CoverLetter
> + fields = ['series', 'submitter']
> +
> +
> +class PatchFilter(FilterSet):
> +
> + class Meta:
> + model = Patch
> + fields = ['series', 'submitter', 'delegate', 'state', 'archived']
'project' would be useful for all of these as well, I think.
> diff --git a/requirements-test.txt b/requirements-test.txt
> index 7cb5ae9..c664976 100644
> --- a/requirements-test.txt
> +++ b/requirements-test.txt
> @@ -3,4 +3,4 @@ django-debug-toolbar==1.5
> python-dateutil>2.0,<3.0
> selenium>2.0,<3.0
> djangorestframework>=3.4,<3.5
> -drf-nested-routers>=0.11.1,<0.12
Why are we removing this here?
> +django-filter>=0.15,<0.16
>
--
Andrew Donnellan OzLabs, ADL Canberra
andrew.donnellan at au1.ibm.com IBM Australia Limited
More information about the Patchwork
mailing list