[PATCH 03/11] Add support for django-filter 1.1

Daniel Axtens dja at axtens.net
Thu Jul 12 10:32:22 AEST 2018


Stephen Finucane <stephen at that.guru> writes:

LGTM. I want to hold of on a formal review because I have very limited
knowledge of django-filters and haven't done any testing yet.

> +# NAME_FIELD
> +#
> +# The django-filter library renamed 'Filter.name' to 'Filter.field_name' in
> +# 1.1.
> +#
> +# https://django-filter.readthedocs.io/en/master/guide/migration.html\
> +#   #migrating-to-2-0
Personally I'd just go for a long line here but I'm not very fussed.

Regards,
Daniel

> +
> +if settings.ENABLE_REST_API:
> +    import django_filters  # noqa
> +
> +    if django_filters.VERSION >= (1, 1):
> +        NAME_FIELD = 'field_name'
> +    else:
> +        NAME_FIELD = 'name'
> +
> +
>  # reverse, reverse_lazy
>  #
>  # The reverse and reverse_lazy functions have been moved to django.urls in
> diff --git a/releasenotes/notes/django-filter-1-1-6a6b0ab8cbe0faca.yaml b/releasenotes/notes/django-filter-1-1-6a6b0ab8cbe0faca.yaml
> new file mode 100644
> index 00000000..3beb9c08
> --- /dev/null
> +++ b/releasenotes/notes/django-filter-1-1-6a6b0ab8cbe0faca.yaml
> @@ -0,0 +1,6 @@
> +---
> +upgrade:
> +  - |
> +    `django-filter 1.1
> +    <https://github.com/carltongibson/django-filter/releases/tag/1.1.0>`_ is
> +    now supported.
> diff --git a/requirements-dev.txt b/requirements-dev.txt
> index b12246dd..1d58df71 100644
> --- a/requirements-dev.txt
> +++ b/requirements-dev.txt
> @@ -1,4 +1,4 @@
>  Django>=1.8,<2.0
>  djangorestframework>=3.4,<3.9
> -django-filter>=1.0,<1.1
> +django-filter>=1.0,<1.2
>  -r requirements-test.txt
> diff --git a/requirements-prod.txt b/requirements-prod.txt
> index 42ff8ecd..59e2c1e6 100644
> --- a/requirements-prod.txt
> +++ b/requirements-prod.txt
> @@ -1,5 +1,5 @@
>  Django>=1.8,<2.0
>  djangorestframework>=3.4,<3.9
> -django-filter>=1.0,<1.1
> +django-filter>=1.0,<1.2
>  psycopg2>=2.7,<2.8
>  sqlparse==0.2.4
> diff --git a/tox.ini b/tox.ini
> index c1bc64e3..9aac8247 100644
> --- a/tox.ini
> +++ b/tox.ini
> @@ -13,7 +13,8 @@ deps =
>      django{18,19}: djangorestframework>=3.4,<3.7
>      django110: djangorestframework>=3.4,<3.9
>      django111: djangorestframework>=3.6,<3.9
> -    django{18,19,110,111}: django-filter>=1.0,<1.1
> +    django18: django-filter>=1.0,<1.1
> +    django{19,110,111}: django-filter>=1.0,<1.2
>  setenv =
>      DJANGO_SETTINGS_MODULE = patchwork.settings.dev
>      PYTHONDONTWRITEBYTECODE = 1
> -- 
> 2.17.1
>
> _______________________________________________
> Patchwork mailing list
> Patchwork at lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/patchwork


More information about the Patchwork mailing list