Skip to content

Commit 9d42d9b

Browse files
slivercn2ygk
authored andcommitted
Add support for Python 3.8, Django 3.0 and DRF 3.11 (#752)
Fixes #751 Fixes #732 Test matrix build by looking to what is officially supported by Django and DRF in there respective release notes.
1 parent 2033bc5 commit 9d42d9b

File tree

15 files changed

+84
-45
lines changed

15 files changed

+84
-45
lines changed

.travis.yml

Lines changed: 39 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
language: python
2+
dist: xenial
23
sudo: required
34
cache: pip
45
# Favor explicit over implicit and use an explicit build matrix.
@@ -12,6 +13,10 @@ matrix:
1213
- env: TOXENV=py35-django22-drfmaster
1314
- env: TOXENV=py36-django22-drfmaster
1415
- env: TOXENV=py37-django22-drfmaster
16+
- env: TOXENV=py38-django22-drfmaster
17+
- env: TOXENV=py36-django30-drfmaster
18+
- env: TOXENV=py37-django30-drfmaster
19+
- env: TOXENV=py38-django30-drfmaster
1520

1621
include:
1722
- python: 3.6
@@ -21,50 +26,72 @@ matrix:
2126

2227
- python: 3.5
2328
env: TOXENV=py35-django111-drf310
29+
- python: 3.5
30+
env: TOXENV=py35-django111-drf311
2431
- python: 3.5
2532
env: TOXENV=py35-django111-drfmaster
2633
- python: 3.5
2734
env: TOXENV=py35-django21-drf310
35+
- python: 3.5
36+
env: TOXENV=py35-django21-drf311
2837
- python: 3.5
2938
env: TOXENV=py35-django21-drfmaster
3039
- python: 3.5
31-
dist: xenial
3240
env: TOXENV=py35-django22-drf310
3341
- python: 3.5
34-
dist: xenial
42+
env: TOXENV=py35-django22-drf311
43+
- python: 3.5
3544
env: TOXENV=py35-django22-drfmaster
3645

3746
- python: 3.6
3847
env: TOXENV=py36-django111-drf310
48+
- python: 3.6
49+
env: TOXENV=py36-django111-drf311
3950
- python: 3.6
4051
env: TOXENV=py36-django111-drfmaster
4152
- python: 3.6
4253
env: TOXENV=py36-django21-drf310
54+
- python: 3.6
55+
env: TOXENV=py36-django21-drf311
4356
- python: 3.6
4457
env: TOXENV=py36-django21-drfmaster
4558
- python: 3.6
46-
dist: xenial
4759
env: TOXENV=py36-django22-drf310
4860
- python: 3.6
49-
dist: xenial
61+
env: TOXENV=py36-django22-drf311
62+
- python: 3.6
5063
env: TOXENV=py36-django22-drfmaster
64+
- python: 3.6
65+
env: TOXENV=py36-django30-drf311
66+
- python: 3.6
67+
env: TOXENV=py36-django30-drfmaster
5168

5269
- python: 3.7
53-
dist: xenial
54-
sudo: required
5570
env: TOXENV=py37-django21-drf310
5671
- python: 3.7
57-
dist: xenial
58-
sudo: required
72+
env: TOXENV=py37-django21-drf311
73+
- python: 3.7
5974
env: TOXENV=py37-django21-drfmaster
6075
- python: 3.7
61-
dist: xenial
62-
sudo: required
6376
env: TOXENV=py37-django22-drf310
6477
- python: 3.7
65-
dist: xenial
66-
sudo: required
78+
env: TOXENV=py37-django22-drf311
79+
- python: 3.7
6780
env: TOXENV=py37-django22-drfmaster
81+
- python: 3.7
82+
env: TOXENV=py37-django30-drf311
83+
- python: 3.7
84+
env: TOXENV=py37-django30-drfmaster
85+
86+
- python: 3.8
87+
env: TOXENV=py38-django22-drf311
88+
- python: 3.8
89+
env: TOXENV=py38-django22-drfmaster
90+
- python: 3.8
91+
env: TOXENV=py38-django30-drf311
92+
- python: 3.8
93+
env: TOXENV=py38-django30-drfmaster
94+
6895
install:
6996
- pip install tox
7097
script:

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88
Note that in line with [Django REST Framework policy](http://www.django-rest-framework.org/topics/release-notes/),
99
any parts of the framework not mentioned in the documentation should generally be considered private API, and may be subject to change.
1010

11+
## [Unreleased]
12+
13+
### Added
14+
15+
* Added support for Python 3.8
16+
* Added support for Django REST framework 3.11
17+
* Added support for Django 3.0
18+
1119
## [3.0.0] - 2019-10-14
1220

1321
This release is not backwards compatible. For easy migration best upgrade first to version

README.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,9 @@ As a Django REST Framework JSON API (short DJA) we are trying to address followi
8787
Requirements
8888
------------
8989

90-
1. Python (3.5, 3.6, 3.7)
91-
2. Django (1.11, 2.1, 2.2)
92-
3. Django REST Framework (3.10)
90+
1. Python (3.5, 3.6, 3.7, 3.8)
91+
2. Django (1.11, 2.1, 2.2, 3.0)
92+
3. Django REST Framework (3.10, 3.11)
9393

9494
We **highly** recommend and only officially support the latest patch release of each Python, Django and REST Framework series.
9595

docs/getting-started.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ like the following:
5151

5252
## Requirements
5353

54-
1. Python (3.5, 3.6, 3.7)
55-
2. Django (1.11, 2.1, 2.2)
56-
3. Django REST Framework (3.10)
54+
1. Python (3.5, 3.6, 3.7, 3.8)
55+
2. Django (1.11, 2.1, 2.2, 3.0)
56+
3. Django REST Framework (3.10, 3.11)
5757

5858
We **highly** recommend and only officially support the latest patch release of each Python, Django and REST Framework series.
5959

example/api/resources/identity.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ def posts(self, request):
2323
posts = [{'id': 1, 'title': 'Test Blog Post'}]
2424

2525
data = {
26-
encoding.force_text('identities'): IdentitySerializer(identities, many=True).data,
27-
encoding.force_text('posts'): PostSerializer(posts, many=True).data,
26+
encoding.force_str('identities'): IdentitySerializer(identities, many=True).data,
27+
encoding.force_str('posts'): PostSerializer(posts, many=True).data,
2828
}
2929
return Response(utils.format_field_names(data, format_type='camelize'))
3030

example/tests/test_format_keys.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def test_camelization(self):
2828
'data': [
2929
{
3030
'type': 'users',
31-
'id': encoding.force_text(user.pk),
31+
'id': encoding.force_str(user.pk),
3232
'attributes': {
3333
'firstName': user.first_name,
3434
'lastName': user.last_name,

example/tests/test_model_viewsets.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def test_key_in_list_result(self):
3434
'data': [
3535
{
3636
'type': 'users',
37-
'id': encoding.force_text(user.pk),
37+
'id': encoding.force_str(user.pk),
3838
'attributes': {
3939
'first-name': user.first_name,
4040
'last-name': user.last_name,
@@ -72,7 +72,7 @@ def test_page_two_in_list_result(self):
7272
'data': [
7373
{
7474
'type': 'users',
75-
'id': encoding.force_text(user.pk),
75+
'id': encoding.force_str(user.pk),
7676
'attributes': {
7777
'first-name': user.first_name,
7878
'last-name': user.last_name,
@@ -112,7 +112,7 @@ def test_page_range_in_list_result(self):
112112
'data': [
113113
{
114114
'type': 'users',
115-
'id': encoding.force_text(users[0].pk),
115+
'id': encoding.force_str(users[0].pk),
116116
'attributes': {
117117
'first-name': users[0].first_name,
118118
'last-name': users[0].last_name,
@@ -121,7 +121,7 @@ def test_page_range_in_list_result(self):
121121
},
122122
{
123123
'type': 'users',
124-
'id': encoding.force_text(users[1].pk),
124+
'id': encoding.force_str(users[1].pk),
125125
'attributes': {
126126
'first-name': users[1].first_name,
127127
'last-name': users[1].last_name,
@@ -157,7 +157,7 @@ def test_key_in_detail_result(self):
157157
expected = {
158158
'data': {
159159
'type': 'users',
160-
'id': encoding.force_text(self.miles.pk),
160+
'id': encoding.force_str(self.miles.pk),
161161
'attributes': {
162162
'first-name': self.miles.first_name,
163163
'last-name': self.miles.last_name,
@@ -193,7 +193,7 @@ def test_key_in_post(self):
193193
data = {
194194
'data': {
195195
'type': 'users',
196-
'id': encoding.force_text(self.miles.pk),
196+
'id': encoding.force_str(self.miles.pk),
197197
'attributes': {
198198
'first-name': self.miles.first_name,
199199
'last-name': self.miles.last_name,

example/tests/test_sideload_resources.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,5 @@ def test_get_sideloaded_data(self):
2525

2626
self.assertEqual(
2727
sorted(content.keys()),
28-
[encoding.force_text('identities'),
29-
encoding.force_text('posts')])
28+
[encoding.force_str('identities'),
29+
encoding.force_str('posts')])

rest_framework_json_api/exceptions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from django.utils.translation import ugettext_lazy as _
1+
from django.utils.translation import gettext_lazy as _
22
from rest_framework import exceptions, status
33

44
from rest_framework_json_api import utils

rest_framework_json_api/metadata.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from collections import OrderedDict
22

33
from django.db.models.fields import related
4-
from django.utils.encoding import force_text
4+
from django.utils.encoding import force_str
55
from rest_framework import serializers
66
from rest_framework.metadata import SimpleMetadata
77
from rest_framework.settings import api_settings
@@ -123,7 +123,7 @@ def get_field_info(self, field):
123123
for attr in attrs:
124124
value = getattr(field, attr, None)
125125
if value is not None and value != '':
126-
field_info[attr] = force_text(value, strings_only=True)
126+
field_info[attr] = force_str(value, strings_only=True)
127127

128128
if getattr(field, 'child', None):
129129
field_info['child'] = self.get_field_info(field.child)
@@ -138,7 +138,7 @@ def get_field_info(self, field):
138138
field_info['choices'] = [
139139
{
140140
'value': choice_value,
141-
'display_name': force_text(choice_name, strings_only=True)
141+
'display_name': force_str(choice_name, strings_only=True)
142142
}
143143
for choice_value, choice_name in field.choices.items()
144144
]

0 commit comments

Comments
 (0)