Skip to content

Commit 0158bc0

Browse files
goodtuneconst-cloudinary
authored andcommitted
Add Django 3.0 support
* Django 3.0 - adapt `from_db_value` to satisfy method signature See https://docs.djangoproject.com/en/3.0/releases/2.0/#deprecated-features-2-0 * Update testing configuration for Django 3.0
1 parent 741c13b commit 0158bc0

File tree

3 files changed

+15
-7
lines changed

3 files changed

+15
-7
lines changed

.travis.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ matrix:
2929
env: TOXENV=py36-django111
3030
- python: 3.6
3131
env: TOXENV=py36-django22
32+
- python: 3.6
33+
env: TOXENV=py36-django30
3234
- python: 3.5
3335
env: TOXENV=py35-django20
3436
- python: 3.7
@@ -43,6 +45,10 @@ matrix:
4345
dist: xenial
4446
sudo: true
4547
env: TOXENV=py37-django22
48+
- python: 3.7
49+
dist: xenial
50+
sudo: true
51+
env: TOXENV=py37-django30
4652
install:
4753
- pip install tox
4854
script:

cloudinary/models.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,11 @@ def parse_cloudinary_resource(self, value):
8686
format=m.group('format')
8787
)
8888

89-
def from_db_value(self, value, expression, connection, context):
90-
if value is None:
91-
return value
92-
return self.parse_cloudinary_resource(value)
89+
def from_db_value(self, value, expression, connection, *args, **kwargs):
90+
# TODO: when dropping support for versions prior to 2.0, you may return
91+
# the signature to from_db_value(value, expression, connection)
92+
if value is not None:
93+
return self.parse_cloudinary_resource(value)
9394

9495
def to_python(self, value):
9596
if isinstance(value, CloudinaryResource):

tox.ini

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ envlist =
33
py{27,34,35,36,37}-core
44
py{27,34,35}-django{18,19,110}
55
py{27,34,35,36}-django{111}
6-
py{36,37}-django{20,21,22}
6+
py{36,37}-django{20,21,22,30}
77
[testenv]
88
usedevelop = True
99
commands =
10-
py{27,34,35,36,37}-core: python setup.py test {env:P_ARGS:}
11-
py{27,34,35,36,37}-django{18,19,110,111,20,21,22}: django-admin.py test -v2 django_tests {env:D_ARGS:}
10+
core: python setup.py test {env:P_ARGS:}
11+
django{18,19,110,111,20,21,22,30}: django-admin.py test -v2 django_tests {env:D_ARGS:}
1212
passenv = *
1313
deps =
1414
django18: Django>=1.8,<1.9
@@ -18,5 +18,6 @@ deps =
1818
django20: Django>=2.0,<2.1
1919
django21: Django>=2.1,<2.2
2020
django22: Django>=2.2,<2.3
21+
django30: Django>=3.0,<3.1
2122
setenv =
2223
DJANGO_SETTINGS_MODULE=django_tests.settings

0 commit comments

Comments
 (0)