diff -Nru djangorestframework-gis-0.11/CHANGES.rst djangorestframework-gis-0.11.2/CHANGES.rst --- djangorestframework-gis-0.11/CHANGES.rst 2016-11-22 12:27:40.000000000 +0000 +++ djangorestframework-gis-0.11.2/CHANGES.rst 2017-05-22 09:40:39.000000000 +0000 @@ -1,6 +1,18 @@ Changelog ========= +Version 0.11.2 [2017-05-22] +--------------------------- + +- `eb54fc0 `_: ``GeometryFilter`` now use ``BaseGeometryWidget`` +- `33a6418 `_: fixed tests for Django 1.11: ``Point`` comparison uses ``srid`` + +Version 0.11.1 [2017-05-05] +--------------------------- + +- `#119 `_: Added support to "__all__" fields in serializer +- `#130 `_: Added compatibility with DRF 3.6 + Version 0.11.0 [2016-11-22] --------------------------- diff -Nru djangorestframework-gis-0.11/debian/changelog djangorestframework-gis-0.11.2/debian/changelog --- djangorestframework-gis-0.11/debian/changelog 2016-11-23 20:09:11.000000000 +0000 +++ djangorestframework-gis-0.11.2/debian/changelog 2017-08-04 18:47:59.000000000 +0000 @@ -1,3 +1,25 @@ +djangorestframework-gis (0.11.2-1) unstable; urgency=low + + * Upload to unstable (Closes: #865920). + * Bump Standards-Version to 4.0.0. + * Refresh patches after git-dpm to gbp pq conversion + + -- Michael Fladischer Fri, 04 Aug 2017 20:47:59 +0200 + +djangorestframework-gis (0.11.2-1~exp1) experimental; urgency=low + + * New upstream release. + + -- Michael Fladischer Sun, 28 May 2017 11:35:54 +0200 + +djangorestframework-gis (0.11.1-1~exp1) experimental; urgency=low + + * New upstream release. + * Remove unused lintian override as we now check for valid signatures + on upstream tarballs. + + -- Michael Fladischer Fri, 12 May 2017 20:06:55 +0200 + djangorestframework-gis (0.11-1) unstable; urgency=low * New upstream release. diff -Nru djangorestframework-gis-0.11/debian/control djangorestframework-gis-0.11.2/debian/control --- djangorestframework-gis-0.11/debian/control 2016-11-23 20:09:11.000000000 +0000 +++ djangorestframework-gis-0.11.2/debian/control 2017-08-04 18:47:59.000000000 +0000 @@ -16,7 +16,7 @@ python3-django-filters, python3-gdal, python3-setuptools -Standards-Version: 3.9.8 +Standards-Version: 4.0.0 X-Python-Version: >= 2.6 X-Python3-Version: >= 3.3 Homepage: https://github.com/djangonauts/django-rest-framework-gis diff -Nru djangorestframework-gis-0.11/debian/gbp.conf djangorestframework-gis-0.11.2/debian/gbp.conf --- djangorestframework-gis-0.11/debian/gbp.conf 1970-01-01 00:00:00.000000000 +0000 +++ djangorestframework-gis-0.11.2/debian/gbp.conf 2017-08-04 18:47:59.000000000 +0000 @@ -0,0 +1,2 @@ +[DEFAULT] +debian-branch=debian/master diff -Nru djangorestframework-gis-0.11/debian/.git-dpm djangorestframework-gis-0.11.2/debian/.git-dpm --- djangorestframework-gis-0.11/debian/.git-dpm 2016-11-23 20:09:11.000000000 +0000 +++ djangorestframework-gis-0.11.2/debian/.git-dpm 1970-01-01 00:00:00.000000000 +0000 @@ -1,11 +0,0 @@ -# see git-dpm(1) from git-dpm package -a00e23a9013ec37e22dbf739909d31c94b52711e -a00e23a9013ec37e22dbf739909d31c94b52711e -5fd992e9c7cd507886df9266d61631d81cbfc90e -5fd992e9c7cd507886df9266d61631d81cbfc90e -djangorestframework-gis_0.11.orig.tar.gz -5f83223fd778587e3206d61203bf5b8e9a008e35 -27285 -debianTag="debian/%e%v" -patchedTag="patched/%e%v" -upstreamTag="upstream/%e%u" diff -Nru djangorestframework-gis-0.11/debian/patches/0002-Do-not-import-local-settings-for-tests.patch djangorestframework-gis-0.11.2/debian/patches/0002-Do-not-import-local-settings-for-tests.patch --- djangorestframework-gis-0.11/debian/patches/0002-Do-not-import-local-settings-for-tests.patch 2016-11-23 20:09:11.000000000 +0000 +++ djangorestframework-gis-0.11.2/debian/patches/0002-Do-not-import-local-settings-for-tests.patch 2017-08-04 18:47:59.000000000 +0000 @@ -1,4 +1,3 @@ -From a54af50f2774f3ca35fa4326c0bcf84dd3325d44 Mon Sep 17 00:00:00 2001 From: Michael Fladischer Date: Thu, 7 Jan 2016 12:23:10 +0100 Subject: Do not import local settings for tests. diff -Nru djangorestframework-gis-0.11/debian/patches/0003-Add-TEMPLATES-setting-for-Django-1.8.patch djangorestframework-gis-0.11.2/debian/patches/0003-Add-TEMPLATES-setting-for-Django-1.8.patch --- djangorestframework-gis-0.11/debian/patches/0003-Add-TEMPLATES-setting-for-Django-1.8.patch 2016-11-23 20:09:11.000000000 +0000 +++ djangorestframework-gis-0.11.2/debian/patches/0003-Add-TEMPLATES-setting-for-Django-1.8.patch 2017-08-04 18:47:59.000000000 +0000 @@ -1,4 +1,3 @@ -From a00e23a9013ec37e22dbf739909d31c94b52711e Mon Sep 17 00:00:00 2001 From: Michael Fladischer Date: Mon, 17 Oct 2016 13:44:45 +0200 Subject: Add TEMPLATES setting for Django 1.8+. diff -Nru djangorestframework-gis-0.11/debian/patches/spatialite.patch djangorestframework-gis-0.11.2/debian/patches/spatialite.patch --- djangorestframework-gis-0.11/debian/patches/spatialite.patch 2016-11-23 20:09:11.000000000 +0000 +++ djangorestframework-gis-0.11.2/debian/patches/spatialite.patch 2017-08-04 18:47:59.000000000 +0000 @@ -1,4 +1,3 @@ -From 7695f49eb8ecce08ba1c036f94416114710fd7b6 Mon Sep 17 00:00:00 2001 From: Michael Fladischer Date: Thu, 8 Oct 2015 08:58:54 -0700 Subject: Use spatialite backend for tests. diff -Nru djangorestframework-gis-0.11/debian/source/lintian-overrides djangorestframework-gis-0.11.2/debian/source/lintian-overrides --- djangorestframework-gis-0.11/debian/source/lintian-overrides 2016-11-23 20:09:11.000000000 +0000 +++ djangorestframework-gis-0.11.2/debian/source/lintian-overrides 1970-01-01 00:00:00.000000000 +0000 @@ -1,2 +0,0 @@ -# Upstream does not provide detached PGP signatures for their source tarballs. -djangorestframework-gis source: debian-watch-may-check-gpg-signature diff -Nru djangorestframework-gis-0.11/djangorestframework_gis.egg-info/PKG-INFO djangorestframework-gis-0.11.2/djangorestframework_gis.egg-info/PKG-INFO --- djangorestframework-gis-0.11/djangorestframework_gis.egg-info/PKG-INFO 2016-11-22 12:28:37.000000000 +0000 +++ djangorestframework-gis-0.11.2/djangorestframework_gis.egg-info/PKG-INFO 2017-05-22 09:49:16.000000000 +0000 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: djangorestframework-gis -Version: 0.11 +Version: 0.11.2 Summary: Geographic add-ons for Django Rest Framework Home-page: https://github.com/djangonauts/django-rest-framework-gis Author: Douglas Meehan diff -Nru djangorestframework-gis-0.11/djangorestframework_gis.egg-info/requires.txt djangorestframework-gis-0.11.2/djangorestframework_gis.egg-info/requires.txt --- djangorestframework-gis-0.11/djangorestframework_gis.egg-info/requires.txt 2016-11-22 12:28:37.000000000 +0000 +++ djangorestframework-gis-0.11.2/djangorestframework_gis.egg-info/requires.txt 2017-05-22 09:49:16.000000000 +0000 @@ -1 +1 @@ -djangorestframework>=3.3,<3.6 +djangorestframework>=3.3,<3.7 diff -Nru djangorestframework-gis-0.11/djangorestframework_gis.egg-info/SOURCES.txt djangorestframework-gis-0.11.2/djangorestframework_gis.egg-info/SOURCES.txt --- djangorestframework-gis-0.11/djangorestframework_gis.egg-info/SOURCES.txt 2016-11-22 12:28:39.000000000 +0000 +++ djangorestframework-gis-0.11.2/djangorestframework_gis.egg-info/SOURCES.txt 2017-05-22 09:49:17.000000000 +0000 @@ -20,7 +20,6 @@ rest_framework_gis/pagination.py rest_framework_gis/serializers.py rest_framework_gis/tilenames.py -tests/__init__.py tests/local_settings.example.py tests/local_settings.py tests/manage.py diff -Nru djangorestframework-gis-0.11/PKG-INFO djangorestframework-gis-0.11.2/PKG-INFO --- djangorestframework-gis-0.11/PKG-INFO 2016-11-22 12:28:39.000000000 +0000 +++ djangorestframework-gis-0.11.2/PKG-INFO 2017-05-22 09:49:17.000000000 +0000 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: djangorestframework-gis -Version: 0.11 +Version: 0.11.2 Summary: Geographic add-ons for Django Rest Framework Home-page: https://github.com/djangonauts/django-rest-framework-gis Author: Douglas Meehan diff -Nru djangorestframework-gis-0.11/README.rst djangorestframework-gis-0.11.2/README.rst --- djangorestframework-gis-0.11/README.rst 2016-11-22 12:02:00.000000000 +0000 +++ djangorestframework-gis-0.11.2/README.rst 2017-05-22 09:38:46.000000000 +0000 @@ -39,7 +39,7 @@ =============== ============================ ==================== ================================== DRF-gis version DRF version Django version Python version -**0.11.x** **3.1** to **3.5** **1.7** to **1.10** **2.7** to **3.5** +**0.11.x** **3.1** to **3.6** **1.7** to **1.11** **2.7** to **3.6** **0.10.x** **3.1** to **3.3** **1.7** to **1.9** **2.7** to **3.5** **0.9.6** **3.1** to **3.2** **1.5** to **1.8** **2.6** to **3.5** **0.9.5** **3.1** to **3.2** **1.5** to **1.8** **2.6** to **3.4** @@ -429,9 +429,7 @@ 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 `_). +**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 @@ -444,10 +442,12 @@ .. code-block:: python from rest_framework_gis.filterset import GeoFilterSet + from rest_framework_gis.filters import GeometryFilter + from django_filters import filters 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 = GeometryFilter(name='geom', lookup_expr='contains') class Meta: model = Region @@ -485,8 +485,8 @@ filter_backends = (InBBoxFilter, ) bbox_filter_include_overlapping = True # Optional -We can then filter in the URL, using Bounding Box format (min Lon, min -Lat, max Lon, max Lat), and we can search for instances within the +We can then filter in the URL, using Bounding Box format (min Lat, min +Lon, max Lat, max Lon), and we can search for instances within the bounding box, e.g.: ``/location/?in_bbox=-90,29,-89,35``. @@ -574,25 +574,29 @@ Running the tests ----------------- -Assuming one has the dependencies installed (restframework and -restframework\_gis), and one of the `Spatial Database server supported -by -GeoDjango `__ -is up and running: +Required setup +============== + +You need one of the `Spatial Database servers supported by +GeoDjango `__, +and create a database for the tests. + +The following can be used with PostgreSQL: .. code-block:: bash - ./runtests.py + createdb django_restframework_gis + psql -U postgres -d django_restframework_gis -c "CREATE EXTENSION postgis" You might need to tweak the DB settings according to your DB configuration. You can copy the file ``local_settings.example.py`` to ``local_settings.py`` and change the ``DATABASES`` and/or ``INSTALLED_APPS`` directives there. -If you want to contribute you need to install the test app in a proper -development environment. +This should allow you to run the tests already. -These steps should do the trick: +For reference, the following steps will setup a development environment for +contributing to the project: - create a spatial database named "django\_restframework\_gis" - create ``local_settings.py``, eg: @@ -606,6 +610,35 @@ - run ``python manage.py collectstatic`` - run ``python manage.py runserver`` +Using tox +========= + +The recommended way to run the tests is by using +`tox `__, which can be installed using +`pip install tox`. + +You can use ``tox -l`` to list the available environments, and then e.g. use +the following to run all tests with Python 3.6 and Django 1.11: + +.. code-block:: bash + + tox -e py36-django111 + +By default Django's test runner is used, but there is a variation of tox's +envlist to use pytest (using the ``-pytest`` suffix). + +You can pass optional arguments to the test runner like this: + +.. code-block:: bash + + tox -e py36-django111-pytest -- -k test_foo + +Running tests manually +====================== + +Please refer to the ``tox.ini`` file for reference/help in case you want to run +tests manually / without tox. + Contributing ------------ diff -Nru djangorestframework-gis-0.11/requirements.txt djangorestframework-gis-0.11.2/requirements.txt --- djangorestframework-gis-0.11/requirements.txt 2016-11-22 12:02:00.000000000 +0000 +++ djangorestframework-gis-0.11.2/requirements.txt 2017-05-05 08:57:40.000000000 +0000 @@ -1 +1 @@ -djangorestframework>=3.3,<3.6 +djangorestframework>=3.3,<3.7 diff -Nru djangorestframework-gis-0.11/rest_framework_gis/filters.py djangorestframework-gis-0.11.2/rest_framework_gis/filters.py --- djangorestframework-gis-0.11/rest_framework_gis/filters.py 2016-11-22 11:54:54.000000000 +0000 +++ djangorestframework-gis-0.11.2/rest_framework_gis/filters.py 2017-05-22 09:14:32.000000000 +0000 @@ -75,6 +75,10 @@ class GeometryFilter(django_filters.Filter): field_class = forms.GeometryField + def __init__(self, *args, **kwargs): + kwargs.setdefault('widget', forms.BaseGeometryWidget) + super(GeometryFilter, self).__init__(*args, **kwargs) + class GeoFilterSet(django_filters.FilterSet): GEOFILTER_FOR_DBFIELD_DEFAULTS = { diff -Nru djangorestframework-gis-0.11/rest_framework_gis/__init__.py djangorestframework-gis-0.11.2/rest_framework_gis/__init__.py --- djangorestframework-gis-0.11/rest_framework_gis/__init__.py 2016-11-22 12:22:09.000000000 +0000 +++ djangorestframework-gis-0.11.2/rest_framework_gis/__init__.py 2017-05-22 09:31:11.000000000 +0000 @@ -1,4 +1,4 @@ -VERSION = (0, 11, 0, 'final') +VERSION = (0, 11, 2, 'final') __version__ = VERSION # alias diff -Nru djangorestframework-gis-0.11/rest_framework_gis/serializers.py djangorestframework-gis-0.11.2/rest_framework_gis/serializers.py --- djangorestframework-gis-0.11/rest_framework_gis/serializers.py 2016-04-13 07:47:37.000000000 +0000 +++ djangorestframework-gis-0.11.2/rest_framework_gis/serializers.py 2017-05-05 08:57:16.000000000 +0000 @@ -53,7 +53,7 @@ default_id_field = None primary_key = self.Meta.model._meta.pk.name # use primary key as id_field when possible - if not hasattr(meta, 'fields') or primary_key in meta.fields: + if not hasattr(meta, 'fields') or meta.fields == '__all__' or primary_key in meta.fields: default_id_field = primary_key meta.id_field = getattr(meta, 'id_field', default_id_field) @@ -67,7 +67,7 @@ def add_to_fields(field_name): """Make sure the field is included in the fields""" - if hasattr(meta, 'fields'): + if hasattr(meta, 'fields') and meta.fields != '__all__': if field_name not in meta.fields: if type(meta.fields) is tuple: additional_fields = (field_name,) diff -Nru djangorestframework-gis-0.11/setup.cfg djangorestframework-gis-0.11.2/setup.cfg --- djangorestframework-gis-0.11/setup.cfg 2016-11-22 12:28:39.000000000 +0000 +++ djangorestframework-gis-0.11.2/setup.cfg 2017-05-22 09:49:17.000000000 +0000 @@ -2,7 +2,7 @@ universal = 1 [egg_info] -tag_date = 0 -tag_svn_revision = 0 tag_build = +tag_svn_revision = 0 +tag_date = 0 diff -Nru djangorestframework-gis-0.11/setup.py djangorestframework-gis-0.11.2/setup.py --- djangorestframework-gis-0.11/setup.py 2016-01-06 12:01:58.000000000 +0000 +++ djangorestframework-gis-0.11.2/setup.py 2017-05-05 09:33:27.000000000 +0000 @@ -20,7 +20,9 @@ if sys.argv[-1] == 'publish': - os.system("python setup.py sdist bdist_wheel upload -s") + os.system("python setup.py sdist bdist_wheel") + os.system("twine upload -s dist/*") + os.system("rm -rf dist build") args = {'version': get_version()} print("You probably want to also tag the version now:") print(" git tag -a %(version)s -m 'version %(version)s'" % args) diff -Nru djangorestframework-gis-0.11/tests/django_restframework_gis_tests/serializers.py djangorestframework-gis-0.11.2/tests/django_restframework_gis_tests/serializers.py --- djangorestframework-gis-0.11/tests/django_restframework_gis_tests/serializers.py 2016-11-22 11:54:54.000000000 +0000 +++ djangorestframework-gis-0.11.2/tests/django_restframework_gis_tests/serializers.py 2017-05-05 08:57:16.000000000 +0000 @@ -27,7 +27,7 @@ class Meta: model = Location - exclude = [] + fields = '__all__' class PaginatedLocationGeoSerializer(pagination.PageNumberPagination): @@ -47,7 +47,7 @@ class Meta: model = Location geo_field = 'geometry' - exclude = [] + fields = '__all__' class LocationGeoFeatureSlugSerializer(LocationGeoFeatureSerializer): @@ -65,7 +65,7 @@ model = Location geo_field = 'geometry' id_field = False - exclude = [] + fields = '__all__' class LocationGeoFeatureNoIdSerializer(LocationGeoFeatureSerializer): diff -Nru djangorestframework-gis-0.11/tests/django_restframework_gis_tests/tests.py djangorestframework-gis-0.11.2/tests/django_restframework_gis_tests/tests.py --- djangorestframework-gis-0.11/tests/django_restframework_gis_tests/tests.py 2016-04-01 16:38:52.000000000 +0000 +++ djangorestframework-gis-0.11.2/tests/django_restframework_gis_tests/tests.py 2017-05-22 09:14:32.000000000 +0000 @@ -487,7 +487,8 @@ self.assertEqual(response.status_code, 200) location_reloaded = Location.objects.get(pk=location.id) self.assertEquals(location_reloaded.name, 'geojson successful patch test') - self.assertEquals(location_reloaded.geometry, Point(10.1, 10.1)) + self.assertEquals(location_reloaded.geometry, + Point(10.1, 10.1, srid=location.geometry.srid)) def test_patch_geojson_location_wo_changing_geometry(self): location = Location.objects.create(name='geojson patch test', geometry='POINT (135.0 45.0)') @@ -501,13 +502,15 @@ self.assertEqual(response.status_code, 200) location_reloaded = Location.objects.get(pk=location.id) self.assertEquals(location_reloaded.name, 'geojson successful patch test') - self.assertEquals(location_reloaded.geometry, Point(135.0, 45.0)) + self.assertEquals(location_reloaded.geometry, + Point(135.0, 45.0, srid=location.geometry.srid)) def test_geometry_serializer_method_field(self): location = Location.objects.create(name='geometry serializer method test', geometry='POINT (135.0 45.0)') location_loaded = Location.objects.get(pk=location.id) self.assertEqual(location_loaded.name, 'geometry serializer method test') - self.assertEqual(location_loaded.geometry, Point(135.0, 45.0)) + self.assertEqual(location_loaded.geometry, + Point(135.0, 45.0, srid=location.geometry.srid)) url = reverse('api_geojson_location_details_hidden', args=[location.id]) data = { "properties": { @@ -523,7 +526,8 @@ def test_geometry_serializer_method_field_none(self): location = Location.objects.create(name='None value', geometry='POINT (135.0 45.0)') location_loaded = Location.objects.get(pk=location.id) - self.assertEqual(location_loaded.geometry, Point(135.0, 45.0)) + self.assertEqual(location_loaded.geometry, + Point(135.0, 45.0, srid=location.geometry.srid)) url = reverse('api_geojson_location_details_none', args=[location.id]) response = self.client.generic('GET', url, content_type='application/json') self.assertEqual(response.status_code, 200) diff -Nru djangorestframework-gis-0.11/tests/django_restframework_gis_tests/views.py djangorestframework-gis-0.11.2/tests/django_restframework_gis_tests/views.py --- djangorestframework-gis-0.11/tests/django_restframework_gis_tests/views.py 2016-11-22 11:26:24.000000000 +0000 +++ djangorestframework-gis-0.11.2/tests/django_restframework_gis_tests/views.py 2017-05-05 08:57:16.000000000 +0000 @@ -132,10 +132,12 @@ 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()