Skip to content

Commit

Permalink
Fix tests for django-filter 1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
blueyed committed Nov 22, 2016
1 parent 7c92536 commit d4c3aa5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
8 changes: 2 additions & 6 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 <https://github.com/djangonauts/django-rest-framework-gis/issues/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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion requirements-test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 3 additions & 1 deletion tests/django_restframework_gis_tests/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit d4c3aa5

Please sign in to comment.