Skip to content

Commit 1bbf6fa

Browse files
authored
Add DRF 3.7 and Django 2.0 to the test matrix. (#394)
* Add DRF 3.7 to the test matrix. Fixes #388 * Switch to an explicit build matrix. * Change env format. Without the equals sign, Travis will drop the double quotes and screw up the environment variable export. * DRF 3.6.x does not support Django 2.0. * Add required on_delete to ForeignKey fields. * Add on_delete to OneToOneField. * Switch core.urlresolvers to urls for Django 2.0 compatibility. * Update minimum required django-polymorphic. Older versions of django-polymorphic don't support Django 2.0
1 parent c926a66 commit 1bbf6fa

22 files changed

+60
-34
lines changed

.travis.yml

+28-7
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,34 @@
22
language: python
33
sudo: false
44
cache: pip
5-
python:
6-
- "2.7"
7-
- "3.4"
8-
- "3.5"
9-
- "3.6"
10-
env:
11-
- DJANGO=">=1.11,<1.12" DRF=">=3.6.3,<3.7"
5+
# Favor explicit over implicit and use an explicit build matrix.
6+
matrix:
7+
include:
8+
- python: 2.7
9+
env: DJANGO=">=1.11,<2.0" DRF=">=3.6.3,<3.7"
10+
- python: 2.7
11+
env: DJANGO=">=1.11,<2.0" DRF=">=3.7.0,<3.8"
12+
13+
- python: 3.4
14+
env: DJANGO=">=1.11,<2.0" DRF=">=3.6.3,<3.7"
15+
- python: 3.4
16+
env: DJANGO=">=1.11,<2.0" DRF=">=3.7.0,<3.8"
17+
- python: 3.4
18+
env: DJANGO=">=2.0,<2.1" DRF=">=3.7.0,<3.8"
19+
20+
- python: 3.5
21+
env: DJANGO=">=1.11,<2.0" DRF=">=3.6.3,<3.7"
22+
- python: 3.5
23+
env: DJANGO=">=1.11,<2.0" DRF=">=3.7.0,<3.8"
24+
- python: 3.5
25+
env: DJANGO=">=2.0,<2.1" DRF=">=3.7.0,<3.8"
26+
27+
- python: 3.6
28+
env: DJANGO=">=1.11,<2.0" DRF=">=3.6.3,<3.7"
29+
- python: 3.6
30+
env: DJANGO=">=1.11,<2.0" DRF=">=3.7.0,<3.8"
31+
- python: 3.6
32+
env: DJANGO=">=2.0,<2.1" DRF=">=3.7.0,<3.8"
1233
before_install:
1334
# Force an upgrade of py & pytest to avoid VersionConflict
1435
- pip install --upgrade py

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
v2.4.0
22

3+
* Add support for Django REST Framework 3.7.x.
4+
* Add support for Django 2.0.
35
* Drop support for Django 1.8 - 1.10 (EOL)
46
* Drop support for Django REST Framework < 3.6.3
57
(3.6.3 is the first to support Django 1.11)

README.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ Requirements
6767
------------
6868

6969
1. Python (2.7, 3.4, 3.5, 3.6)
70-
2. Django (1.11)
71-
3. Django REST Framework (3.6)
70+
2. Django (1.11, 2.0)
71+
3. Django REST Framework (3.6, 3.7)
7272

7373
------------
7474
Installation

docs/getting-started.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ like the following:
5252
## Requirements
5353

5454
1. Python (2.7, 3.4, 3.5, 3.6)
55-
2. Django (1.11)
56-
3. Django REST Framework (3.6)
55+
2. Django (1.11, 2.0)
56+
3. Django REST Framework (3.6, 3.7)
5757

5858
## Installation
5959

example/models.py

+8-6
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class Meta:
6060
class Author(BaseModel):
6161
name = models.CharField(max_length=50)
6262
email = models.EmailField()
63-
type = models.ForeignKey(AuthorType, null=True)
63+
type = models.ForeignKey(AuthorType, null=True, on_delete=models.CASCADE)
6464

6565
def __str__(self):
6666
return self.name
@@ -71,7 +71,7 @@ class Meta:
7171

7272
@python_2_unicode_compatible
7373
class AuthorBio(BaseModel):
74-
author = models.OneToOneField(Author, related_name='bio')
74+
author = models.OneToOneField(Author, related_name='bio', on_delete=models.CASCADE)
7575
body = models.TextField()
7676

7777
def __str__(self):
@@ -83,7 +83,7 @@ class Meta:
8383

8484
@python_2_unicode_compatible
8585
class Entry(BaseModel):
86-
blog = models.ForeignKey(Blog)
86+
blog = models.ForeignKey(Blog, on_delete=models.CASCADE)
8787
headline = models.CharField(max_length=255)
8888
body_text = models.TextField(null=True)
8989
pub_date = models.DateField(null=True)
@@ -103,12 +103,13 @@ class Meta:
103103

104104
@python_2_unicode_compatible
105105
class Comment(BaseModel):
106-
entry = models.ForeignKey(Entry, related_name='comments')
106+
entry = models.ForeignKey(Entry, related_name='comments', on_delete=models.CASCADE)
107107
body = models.TextField()
108108
author = models.ForeignKey(
109109
Author,
110110
null=True,
111-
blank=True
111+
blank=True,
112+
on_delete=models.CASCADE,
112113
)
113114

114115
def __str__(self):
@@ -133,7 +134,8 @@ class ResearchProject(Project):
133134
@python_2_unicode_compatible
134135
class Company(models.Model):
135136
name = models.CharField(max_length=100)
136-
current_project = models.ForeignKey(Project, related_name='companies')
137+
current_project = models.ForeignKey(
138+
Project, related_name='companies', on_delete=models.CASCADE)
137139
future_projects = models.ManyToManyField(Project)
138140

139141
def __str__(self):

example/tests/integration/test_includes.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import pytest
2-
from django.core.urlresolvers import reverse
2+
from django.urls import reverse
33

44
pytestmark = pytest.mark.django_db
55

example/tests/integration/test_meta.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from datetime import datetime
22

33
import pytest
4-
from django.core.urlresolvers import reverse
4+
from django.urls import reverse
55

66
pytestmark = pytest.mark.django_db
77

example/tests/integration/test_model_resource_name.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from copy import deepcopy
22

33
import pytest
4-
from django.core.urlresolvers import reverse
4+
from django.urls import reverse
55
from rest_framework import status
66

77
from example import models, serializers, views

example/tests/integration/test_non_paginated_responses.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import pytest
2-
from django.core.urlresolvers import reverse
2+
from django.urls import reverse
33

44
try:
55
from unittest import mock

example/tests/integration/test_pagination.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import pytest
2-
from django.core.urlresolvers import reverse
2+
from django.urls import reverse
33

44
try:
55
from unittest import mock

example/tests/integration/test_polymorphism.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import random
22

33
import pytest
4-
from django.core.urlresolvers import reverse
4+
from django.urls import reverse
55

66
pytestmark = pytest.mark.django_db
77

example/tests/integration/test_sparse_fieldsets.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import pytest
2-
from django.core.urlresolvers import reverse
2+
from django.urls import reverse
33

44
pytestmark = pytest.mark.django_db
55

example/tests/test_format_keys.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from django.contrib.auth import get_user_model
2-
from django.core.urlresolvers import reverse
2+
from django.urls import reverse
33
from django.utils import encoding
44

55
from example.tests import TestBase

example/tests/test_generic_validation.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from django.core.urlresolvers import reverse
1+
from django.urls import reverse
22

33
from example.tests import TestBase
44

example/tests/test_generic_viewset.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from django.conf import settings
2-
from django.core.urlresolvers import reverse
2+
from django.urls import reverse
33

44
from example.tests import TestBase
55

example/tests/test_model_viewsets.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import pytest
22
from django.conf import settings
33
from django.contrib.auth import get_user_model
4-
from django.core.urlresolvers import reverse
4+
from django.urls import reverse
55
from django.utils import encoding
66

77
from example.tests import TestBase

example/tests/test_multiple_id_mixin.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import json
22

3-
from django.core.urlresolvers import reverse
3+
from django.urls import reverse
44
from django.utils import encoding
55

66
from example.tests import TestBase

example/tests/test_serializers.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import pytest
2-
from django.core.urlresolvers import reverse
32
from django.test import TestCase
3+
from django.urls import reverse
44
from django.utils import timezone
55

66
from rest_framework_json_api.serializers import ResourceIdentifierObjectSerializer

example/tests/test_sideload_resources.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"""
44
import json
55

6-
from django.core.urlresolvers import reverse
6+
from django.urls import reverse
77
from django.utils import encoding
88

99
from example.tests import TestBase

requirements-development.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
-e .
2-
django-polymorphic
2+
django-polymorphic>=2.0
33
Faker
44
isort
55
mock

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ def get_package_data(package):
108108
'factory-boy<2.9.0',
109109
'pytest-django',
110110
'pytest>=2.8,<3',
111-
'django-polymorphic',
111+
'django-polymorphic>=2.0',
112112
'packaging',
113113
'django-debug-toolbar'
114114
] + mock,

tox.ini

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
[tox]
22
envlist =
3-
py{27,34,35,36}-django111-drf{36},
3+
py{27,34,35,36}-django111-drf{36,37},
44

55
[testenv]
66
deps =
77
django111: Django>=1.11,<1.12
88
drf36: djangorestframework>=3.6.3,<3.7
9+
drf37: djangorestframework>=3.7.0,<3.8
910

1011
setenv =
1112
PYTHONPATH = {toxinidir}

0 commit comments

Comments
 (0)