Skip to content

Commit f004181

Browse files
author
Buky
authored
Merge pull request #726 from jazzband/django-3.1
Add complet support for Django 3.1
2 parents b77c508 + f1af32b commit f004181

File tree

7 files changed

+33
-10
lines changed

7 files changed

+33
-10
lines changed

.travis.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,14 @@ matrix:
1919
python: '3.7'
2020
- env: TOXENV=py38-django30
2121
python: '3.8'
22+
- env: TOXENV=pypy3-django31
23+
python: pypy3
24+
- env: TOXENV=py36-django31
25+
python: '3.6'
26+
- env: TOXENV=py37-django31
27+
python: '3.7'
28+
- env: TOXENV=py38-django31
29+
python: '3.8'
2230
- env: TOXENV=py36-django-master
2331
python: '3.6'
2432
- env: TOXENV=py37-django-master

HISTORY.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,17 @@
33
History
44
=======
55

6+
2.0.5
7+
======
8+
9+
* Adding **Django 3.1** compatibility.
10+
* CachedStaticFilesStorage is removed from Django. Add a check
11+
of the current version to prevent error while importing. Thank to @vmsp
12+
* Context in django.template.base is removed from Django and
13+
not used anymore in django-pipeline.
14+
* Fixing widgets tests of django-pipeline due to Media.render_js change in
15+
Django. More information in Django ticket #31892
16+
617
2.0.4
718
======
819

pipeline/storage.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
from io import BytesIO
44

5-
import django
5+
from django import get_version as django_version
66

7-
_CACHED_STATIC_FILES_STORAGE_AVAILABLE = django.VERSION[0] <= 3 and django.VERSION[1] < 1
7+
_CACHED_STATIC_FILES_STORAGE_AVAILABLE = django_version() < '3.1'
88

99
if _CACHED_STATIC_FILES_STORAGE_AVAILABLE:
1010
from django.contrib.staticfiles.storage import CachedStaticFilesStorage

pipeline/templatetags/pipeline.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
from django.contrib.staticfiles.storage import staticfiles_storage
55

66
from django import template
7-
from django.template.context import Context
87
from django.template.base import VariableDoesNotExist
98
from django.template.loader import render_to_string
109
from django.utils.safestring import mark_safe

setup.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
setup(
88
name='django-pipeline',
9-
version='2.0.4',
9+
version='2.0.5',
1010
description='Pipeline is an asset packaging library for Django.',
1111
long_description=io.open('README.rst', encoding='utf-8').read() + '\n\n' +
1212
io.open('HISTORY.rst', encoding='utf-8').read(),
@@ -25,6 +25,7 @@
2525
'Framework :: Django',
2626
'Framework :: Django :: 2.2',
2727
'Framework :: Django :: 3.0',
28+
'Framework :: Django :: 3.1',
2829
'Intended Audience :: Developers',
2930
'License :: OSI Approved :: MIT License',
3031
'Operating System :: OS Independent',

tests/tests/test_forms.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from django import get_version as django_version
12
from django.forms import Media
23
from django.test import TestCase
34

@@ -147,6 +148,7 @@ class MyMedia(PipelineFormMedia):
147148
js = ('extra1.js', 'extra2.js')
148149

149150
media = Media(MyMedia)
151+
script_tag = '<script type="text/javascript" src="%s"></script>' if django_version() < '3.1' else '<script src="%s"></script>'
150152

151153
self.assertEqual(
152154
MyMedia.js,
@@ -160,7 +162,7 @@ class MyMedia(PipelineFormMedia):
160162
self.assertEqual(
161163
media.render_js(),
162164
[
163-
'<script type="text/javascript" src="%s"></script>' % path
165+
script_tag % path
164166
for path in (
165167
'/static/extra1.js',
166168
'/static/extra2.js',
@@ -177,6 +179,7 @@ class MyMedia(PipelineFormMedia):
177179
js = ('extra1.js', 'extra2.js')
178180

179181
media = Media(MyMedia)
182+
script_tag = '<script type="text/javascript" src="%s"></script>' if django_version() < '3.1' else '<script src="%s"></script>'
180183

181184
self.assertEqual(
182185
MyMedia.js,
@@ -191,7 +194,7 @@ class MyMedia(PipelineFormMedia):
191194
self.assertEqual(
192195
media.render_js(),
193196
[
194-
'<script type="text/javascript" src="%s"></script>' % path
197+
script_tag % path
195198
for path in (
196199
'/static/extra1.js',
197200
'/static/extra2.js',

tox.ini

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
[tox]
22
envlist =
3-
pypy3-django{22,30}
4-
py36-django{22,30,-master}
5-
py37-django{22,30,-master}
6-
py38-django{22,30,-master}
3+
pypy3-django{22,30,31}
4+
py36-django{22,30,31,-master}
5+
py37-django{22,30,31,-master}
6+
py38-django{22,30,31,-master}
77
docs
88

99
[testenv]
@@ -16,6 +16,7 @@ deps =
1616
pypy3: mock
1717
django22: Django>=2.2.1,<2.3
1818
django30: Django>=3.0,<3.1
19+
django31: Django>=3.1,<3.2
1920
django-master: https://github.com/django/django/archive/master.tar.gz
2021
jinja2
2122
coverage

0 commit comments

Comments
 (0)