Import djangorestframework-gis_0.11.2.orig.tar.gz
Michael Fladischer
6 years ago
0 | 0 | Changelog |
1 | 1 | ========= |
2 | ||
3 | Version 0.11.2 [2017-05-22] | |
4 | --------------------------- | |
5 | ||
6 | - `eb54fc0 <https://github.com/djangonauts/django-rest-framework-gis/commit/eb54fc0>`_: ``GeometryFilter`` now use ``BaseGeometryWidget`` | |
7 | - `33a6418 <https://github.com/djangonauts/django-rest-framework-gis/commit/33a6418>`_: fixed tests for Django 1.11: ``Point`` comparison uses ``srid`` | |
2 | 8 | |
3 | 9 | Version 0.11.1 [2017-05-05] |
4 | 10 | --------------------------- |
0 | 0 | Metadata-Version: 1.1 |
1 | 1 | Name: djangorestframework-gis |
2 | Version: 0.11.1 | |
2 | Version: 0.11.2 | |
3 | 3 | Summary: Geographic add-ons for Django Rest Framework |
4 | 4 | Home-page: https://github.com/djangonauts/django-rest-framework-gis |
5 | 5 | Author: Douglas Meehan |
38 | 38 | |
39 | 39 | =============== ============================ ==================== ================================== |
40 | 40 | DRF-gis version DRF version Django version Python version |
41 | **0.11.x** **3.1** to **3.6** **1.7** to **1.10** **2.7** to **3.5** | |
41 | **0.11.x** **3.1** to **3.6** **1.7** to **1.11** **2.7** to **3.6** | |
42 | 42 | **0.10.x** **3.1** to **3.3** **1.7** to **1.9** **2.7** to **3.5** |
43 | 43 | **0.9.6** **3.1** to **3.2** **1.5** to **1.8** **2.6** to **3.5** |
44 | 44 | **0.9.5** **3.1** to **3.2** **1.5** to **1.8** **2.6** to **3.4** |
573 | 573 | Running the tests |
574 | 574 | ----------------- |
575 | 575 | |
576 | Assuming one has the dependencies installed (restframework and | |
577 | restframework\_gis), and one of the `Spatial Database server supported | |
578 | by | |
579 | GeoDjango <https://docs.djangoproject.com/en/dev/ref/contrib/gis/db-api/#module-django.contrib.gis.db.backends>`__ | |
580 | is up and running: | |
576 | Required setup | |
577 | ============== | |
578 | ||
579 | You need one of the `Spatial Database servers supported by | |
580 | GeoDjango <https://docs.djangoproject.com/en/dev/ref/contrib/gis/db-api/#module-django.contrib.gis.db.backends>`__, | |
581 | and create a database for the tests. | |
582 | ||
583 | The following can be used with PostgreSQL: | |
581 | 584 | |
582 | 585 | .. code-block:: bash |
583 | 586 | |
584 | ./runtests.py | |
587 | createdb django_restframework_gis | |
588 | psql -U postgres -d django_restframework_gis -c "CREATE EXTENSION postgis" | |
585 | 589 | |
586 | 590 | You might need to tweak the DB settings according to your DB |
587 | 591 | configuration. You can copy the file ``local_settings.example.py`` to |
588 | 592 | ``local_settings.py`` and change the ``DATABASES`` and/or |
589 | 593 | ``INSTALLED_APPS`` directives there. |
590 | 594 | |
591 | If you want to contribute you need to install the test app in a proper | |
592 | development environment. | |
593 | ||
594 | These steps should do the trick: | |
595 | This should allow you to run the tests already. | |
596 | ||
597 | For reference, the following steps will setup a development environment for | |
598 | contributing to the project: | |
595 | 599 | |
596 | 600 | - create a spatial database named "django\_restframework\_gis" |
597 | 601 | - create ``local_settings.py``, eg: |
604 | 608 | - run ``python manage.py syncdb`` |
605 | 609 | - run ``python manage.py collectstatic`` |
606 | 610 | - run ``python manage.py runserver`` |
611 | ||
612 | Using tox | |
613 | ========= | |
614 | ||
615 | The recommended way to run the tests is by using | |
616 | `tox <https://tox.readthedocs.io/en/latest/>`__, which can be installed using | |
617 | `pip install tox`. | |
618 | ||
619 | You can use ``tox -l`` to list the available environments, and then e.g. use | |
620 | the following to run all tests with Python 3.6 and Django 1.11: | |
621 | ||
622 | .. code-block:: bash | |
623 | ||
624 | tox -e py36-django111 | |
625 | ||
626 | By default Django's test runner is used, but there is a variation of tox's | |
627 | envlist to use pytest (using the ``-pytest`` suffix). | |
628 | ||
629 | You can pass optional arguments to the test runner like this: | |
630 | ||
631 | .. code-block:: bash | |
632 | ||
633 | tox -e py36-django111-pytest -- -k test_foo | |
634 | ||
635 | Running tests manually | |
636 | ====================== | |
637 | ||
638 | Please refer to the ``tox.ini`` file for reference/help in case you want to run | |
639 | tests manually / without tox. | |
607 | 640 | |
608 | 641 | Contributing |
609 | 642 | ------------ |
0 | 0 | Metadata-Version: 1.1 |
1 | 1 | Name: djangorestframework-gis |
2 | Version: 0.11.1 | |
2 | Version: 0.11.2 | |
3 | 3 | Summary: Geographic add-ons for Django Rest Framework |
4 | 4 | Home-page: https://github.com/djangonauts/django-rest-framework-gis |
5 | 5 | Author: Douglas Meehan |
19 | 19 | rest_framework_gis/pagination.py |
20 | 20 | rest_framework_gis/serializers.py |
21 | 21 | rest_framework_gis/tilenames.py |
22 | tests/__init__.py | |
23 | 22 | tests/local_settings.example.py |
24 | 23 | tests/local_settings.py |
25 | 24 | tests/manage.py |
0 | VERSION = (0, 11, 1, 'final') | |
0 | VERSION = (0, 11, 2, 'final') | |
1 | 1 | __version__ = VERSION # alias |
2 | 2 | |
3 | 3 |
73 | 73 | |
74 | 74 | class GeometryFilter(django_filters.Filter): |
75 | 75 | field_class = forms.GeometryField |
76 | ||
77 | def __init__(self, *args, **kwargs): | |
78 | kwargs.setdefault('widget', forms.BaseGeometryWidget) | |
79 | super(GeometryFilter, self).__init__(*args, **kwargs) | |
76 | 80 | |
77 | 81 | |
78 | 82 | class GeoFilterSet(django_filters.FilterSet): |
21 | 21 | if sys.argv[-1] == 'publish': |
22 | 22 | os.system("python setup.py sdist bdist_wheel") |
23 | 23 | os.system("twine upload -s dist/*") |
24 | os.system("rm -rf dist") | |
24 | os.system("rm -rf dist build") | |
25 | 25 | args = {'version': get_version()} |
26 | 26 | print("You probably want to also tag the version now:") |
27 | 27 | print(" git tag -a %(version)s -m 'version %(version)s'" % args) |
486 | 486 | self.assertEqual(response.status_code, 200) |
487 | 487 | location_reloaded = Location.objects.get(pk=location.id) |
488 | 488 | self.assertEquals(location_reloaded.name, 'geojson successful patch test') |
489 | self.assertEquals(location_reloaded.geometry, Point(10.1, 10.1)) | |
489 | self.assertEquals(location_reloaded.geometry, | |
490 | Point(10.1, 10.1, srid=location.geometry.srid)) | |
490 | 491 | |
491 | 492 | def test_patch_geojson_location_wo_changing_geometry(self): |
492 | 493 | location = Location.objects.create(name='geojson patch test', geometry='POINT (135.0 45.0)') |
500 | 501 | self.assertEqual(response.status_code, 200) |
501 | 502 | location_reloaded = Location.objects.get(pk=location.id) |
502 | 503 | self.assertEquals(location_reloaded.name, 'geojson successful patch test') |
503 | self.assertEquals(location_reloaded.geometry, Point(135.0, 45.0)) | |
504 | self.assertEquals(location_reloaded.geometry, | |
505 | Point(135.0, 45.0, srid=location.geometry.srid)) | |
504 | 506 | |
505 | 507 | def test_geometry_serializer_method_field(self): |
506 | 508 | location = Location.objects.create(name='geometry serializer method test', geometry='POINT (135.0 45.0)') |
507 | 509 | location_loaded = Location.objects.get(pk=location.id) |
508 | 510 | self.assertEqual(location_loaded.name, 'geometry serializer method test') |
509 | self.assertEqual(location_loaded.geometry, Point(135.0, 45.0)) | |
511 | self.assertEqual(location_loaded.geometry, | |
512 | Point(135.0, 45.0, srid=location.geometry.srid)) | |
510 | 513 | url = reverse('api_geojson_location_details_hidden', args=[location.id]) |
511 | 514 | data = { |
512 | 515 | "properties": { |
522 | 525 | def test_geometry_serializer_method_field_none(self): |
523 | 526 | location = Location.objects.create(name='None value', geometry='POINT (135.0 45.0)') |
524 | 527 | location_loaded = Location.objects.get(pk=location.id) |
525 | self.assertEqual(location_loaded.geometry, Point(135.0, 45.0)) | |
528 | self.assertEqual(location_loaded.geometry, | |
529 | Point(135.0, 45.0, srid=location.geometry.srid)) | |
526 | 530 | url = reverse('api_geojson_location_details_none', args=[location.id]) |
527 | 531 | response = self.client.generic('GET', url, content_type='application/json') |
528 | 532 | self.assertEqual(response.status_code, 200) |