Skip to content

Commit

Permalink
Bring compatibility with django 2.0
Browse files Browse the repository at this point in the history
along the way drop django1.9 and 1.10
  • Loading branch information
ticosax committed Oct 20, 2017
1 parent 9e57496 commit bf85b69
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 29 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ tests/static/
/htmlcov
__pycache__/
*.pyc

.tox/
33 changes: 14 additions & 19 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,20 @@ services:

matrix:
include:
- python: 3.6
env: TOXENV=py36-django111
- python: 3.6
env: TOXENV=py36-django110
- python: 3.6
env: TOXENV=py36-django19

- python: 3.5
env: TOXENV=py35-django110

- python: 3.4
env: TOXENV=py34-django110

- python: 2.7
env: TOXENV=py27-django111
- python: 2.7
env: TOXENV=py27-django110
- python: 2.7
env: TOXENV=py27-django19
- env: TOXENV=py27-django111
python: 2.7
- env: TOXENV=py34-django111
python: 3.4
- env: TOXENV=py35-django111
python: 3.5
- env: TOXENV=py36-django111
python: 3.6
- env: TOXENV=py34-django20
python: 3.4
- env: TOXENV=py35-django20
python: 3.5
- env: TOXENV=py36-django20
python: 3.6

branches:
only:
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Compatibility with DRF, Django and Python

=============== ============================ ==================== ==================================
DRF-gis version DRF version Django version Python version
**0.12.x** **3.1** to **3.7** **1.9** to **1.11** **2.7** to **3.6**
**0.12.x** **3.1** to **3.7** **1.9** to **2.0** **2.7** to **3.6**
**0.11.x** **3.1** to **3.7** **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**
Expand Down
4 changes: 2 additions & 2 deletions rest_framework_gis/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from collections import OrderedDict

from django.contrib.gis.geos import GEOSGeometry, GEOSException
from django.contrib.gis.gdal import OGRException
from django.contrib.gis.gdal import GDALException
from django.core.exceptions import ValidationError
from django.utils.translation import ugettext_lazy as _
from rest_framework.fields import Field, SerializerMethodField
Expand Down Expand Up @@ -38,7 +38,7 @@ def to_internal_value(self, value):
value = json.dumps(value)
try:
return GEOSGeometry(value)
except (ValueError, GEOSException, OGRException, TypeError):
except (ValueError, GEOSException, GDALException, TypeError):
raise ValidationError(_('Invalid format: string or unicode input unrecognized as GeoJSON, WKT EWKT or HEXEWKB.'))

def validate_empty_values(self, data):
Expand Down
1 change: 0 additions & 1 deletion tests/django_restframework_gis_tests/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ class BaseModel(models.Model):
slug = models.SlugField(max_length=128, unique=True, blank=True)
timestamp = models.DateTimeField(null=True, blank=True)
geometry = models.GeometryField()
objects = models.GeoManager()

class Meta:
abstract = True
Expand Down
5 changes: 4 additions & 1 deletion tests/django_restframework_gis_tests/test_bbox.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import json

from django.test import TestCase
from django.core.urlresolvers import reverse
try:
from django.urls import reverse
except ImportError:
from django.core.urlresolvers import reverse
from django.core.exceptions import ImproperlyConfigured

from rest_framework_gis import serializers as gis_serializers
Expand Down
5 changes: 4 additions & 1 deletion tests/django_restframework_gis_tests/test_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@
from django.conf import settings
from django.test import TestCase
from django.contrib.gis.geos import GEOSGeometry, Polygon
from django.core.urlresolvers import reverse
try:
from django.urls import reverse
except ImportError:
from django.core.urlresolvers import reverse

from .models import Location

Expand Down
7 changes: 4 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
[tox]
envlist = py{27,34,35,36,py,py3}-django{19,110,111}{,-pytest}
envlist =
py{27,34,35,36,py,py3}-django111{,-pytest}
py{34,35,36,py3}-django20{,-pytest}

[testenv]
usedevelop = true
Expand All @@ -13,9 +15,8 @@ commands =
{env:DRFG_TEST_RUNNER} {posargs:tests/django_restframework_gis_tests}

deps =
django19: Django>=1.9,<1.10
django110: Django>=1.10,<1.11
django111: Django>=1.11,<2.0
django20: Django>=2.0b1,<2.1
-rrequirements-test.txt
pytest: pytest
pytest: pytest-django

0 comments on commit bf85b69

Please sign in to comment.