From d4c3aa50715e62bf49584c7fe689ed920ee2bd72 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Tue, 22 Nov 2016 15:49:59 +0100 Subject: [PATCH 1/3] Fix tests for django-filter 1.0.0 Fixes https://github.com/djangonauts/django-rest-framework-gis/issues/120. --- README.rst | 8 ++------ requirements-test.txt | 2 +- tests/django_restframework_gis_tests/views.py | 4 +++- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/README.rst b/README.rst index dd09ad4a..32fca2b9 100644 --- a/README.rst +++ b/README.rst @@ -429,10 +429,6 @@ Example result response (cut to one element only instead of 10): Filters ------- -**note**: this feature is compatible with django-filter up to version 0.15. -If you need compatibility with version django-filter 1.0 please send a patch -(see `issue #120 `_). - We provide a ``GeometryFilter`` field as well as a ``GeoFilterSet`` for usage with ``django_filter``. You simply provide, in the query string, one of the textual types supported by ``GEOSGeometry``. By @@ -446,8 +442,8 @@ GeometryFilter from rest_framework_gis.filterset import GeoFilterSet class RegionFilter(GeoFilterSet): - slug = filters.CharFilter(name='slug', lookup_type='istartswith') - contains_geom = filters.GeometryFilter(name='geom', lookup_type='contains') + slug = filters.CharFilter(name='slug', lookup_expr='istartswith') + contains_geom = filters.GeometryFilter(name='geom', lookup_expr='contains') class Meta: model = Region diff --git a/requirements-test.txt b/requirements-test.txt index b1728870..eeb88803 100644 --- a/requirements-test.txt +++ b/requirements-test.txt @@ -2,5 +2,5 @@ psycopg2 djangorestframework>=3.3 coverage==3.7.1 # rq.filter: >=3,<4 coveralls -django-filter>=0.15,<1.0 +django-filter contexttimer diff --git a/tests/django_restframework_gis_tests/views.py b/tests/django_restframework_gis_tests/views.py index 04d03422..4f1e0126 100644 --- a/tests/django_restframework_gis_tests/views.py +++ b/tests/django_restframework_gis_tests/views.py @@ -132,10 +132,12 @@ class GeojsonLocationNoIdDetails(generics.RetrieveUpdateDestroyAPIView): class LocationFilter(GeoFilterSet): - contains_properly = GeometryFilter(name='geometry', lookup_type='contains_properly') + contains_properly = GeometryFilter(name='geometry', + lookup_expr='contains_properly') class Meta: model = Location + fields = ['contains_properly'] class GeojsonLocationContainedInGeometry(generics.ListAPIView): queryset = Location.objects.all() From fa4d90286b0c3cf1cbd7c0291a69c0a7b4f7e880 Mon Sep 17 00:00:00 2001 From: Federico Capoano Date: Tue, 22 Nov 2016 18:37:35 +0100 Subject: [PATCH 2/3] [docs] Added django-filter 1.0 note --- README.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.rst b/README.rst index 32fca2b9..0de42745 100644 --- a/README.rst +++ b/README.rst @@ -429,6 +429,8 @@ Example result response (cut to one element only instead of 10): Filters ------- +**note**: this feature has been tested up to django-filter 1.0. + We provide a ``GeometryFilter`` field as well as a ``GeoFilterSet`` for usage with ``django_filter``. You simply provide, in the query string, one of the textual types supported by ``GEOSGeometry``. By From bd75b1d2d4fd3bdaf3708803699a0c1093f1b942 Mon Sep 17 00:00:00 2001 From: Federico Capoano Date: Tue, 22 Nov 2016 18:38:50 +0100 Subject: [PATCH 3/3] [ci] bind django-filter>=0.15,<1.1 Avoid build breakage by eventual backward incompatible changes introduced in django-filter future versions. --- requirements-test.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements-test.txt b/requirements-test.txt index eeb88803..1cf47a96 100644 --- a/requirements-test.txt +++ b/requirements-test.txt @@ -2,5 +2,5 @@ psycopg2 djangorestframework>=3.3 coverage==3.7.1 # rq.filter: >=3,<4 coveralls -django-filter +django-filter>=0.15,<1.1 contexttimer