Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 1bbf6fa

Browse files
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‎

Lines changed: 28 additions & 7 deletions
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‎

Lines changed: 2 additions & 0 deletions
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‎

Lines changed: 2 additions & 2 deletions
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‎

Lines changed: 2 additions & 2 deletions
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‎

Lines changed: 8 additions & 6 deletions
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‎

Lines changed: 1 addition & 1 deletion
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‎

Lines changed: 1 addition & 1 deletion
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‎

Lines changed: 1 addition & 1 deletion
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‎

Lines changed: 1 addition & 1 deletion
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‎

Lines changed: 1 addition & 1 deletion
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

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /