Skip to content

Commit

Permalink
Merge pull request #726 from jazzband/django-3.1
Browse files Browse the repository at this point in the history
Add complet support for Django 3.1
  • Loading branch information
Buky authored Aug 16, 2020
2 parents b77c508 + f1af32b commit f004181
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 10 deletions.
8 changes: 8 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@ matrix:
python: '3.7'
- env: TOXENV=py38-django30
python: '3.8'
- env: TOXENV=pypy3-django31
python: pypy3
- env: TOXENV=py36-django31
python: '3.6'
- env: TOXENV=py37-django31
python: '3.7'
- env: TOXENV=py38-django31
python: '3.8'
- env: TOXENV=py36-django-master
python: '3.6'
- env: TOXENV=py37-django-master
Expand Down
11 changes: 11 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@
History
=======

2.0.5
======

* Adding **Django 3.1** compatibility.
* CachedStaticFilesStorage is removed from Django. Add a check
of the current version to prevent error while importing. Thank to @vmsp
* Context in django.template.base is removed from Django and
not used anymore in django-pipeline.
* Fixing widgets tests of django-pipeline due to Media.render_js change in
Django. More information in Django ticket #31892

2.0.4
======

Expand Down
4 changes: 2 additions & 2 deletions pipeline/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

from io import BytesIO

import django
from django import get_version as django_version

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

if _CACHED_STATIC_FILES_STORAGE_AVAILABLE:
from django.contrib.staticfiles.storage import CachedStaticFilesStorage
Expand Down
1 change: 0 additions & 1 deletion pipeline/templatetags/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from django.contrib.staticfiles.storage import staticfiles_storage

from django import template
from django.template.context import Context
from django.template.base import VariableDoesNotExist
from django.template.loader import render_to_string
from django.utils.safestring import mark_safe
Expand Down
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

setup(
name='django-pipeline',
version='2.0.4',
version='2.0.5',
description='Pipeline is an asset packaging library for Django.',
long_description=io.open('README.rst', encoding='utf-8').read() + '\n\n' +
io.open('HISTORY.rst', encoding='utf-8').read(),
Expand All @@ -25,6 +25,7 @@
'Framework :: Django',
'Framework :: Django :: 2.2',
'Framework :: Django :: 3.0',
'Framework :: Django :: 3.1',
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
'Operating System :: OS Independent',
Expand Down
7 changes: 5 additions & 2 deletions tests/tests/test_forms.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from django import get_version as django_version
from django.forms import Media
from django.test import TestCase

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

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

self.assertEqual(
MyMedia.js,
Expand All @@ -160,7 +162,7 @@ class MyMedia(PipelineFormMedia):
self.assertEqual(
media.render_js(),
[
'<script type="text/javascript" src="%s"></script>' % path
script_tag % path
for path in (
'/static/extra1.js',
'/static/extra2.js',
Expand All @@ -177,6 +179,7 @@ class MyMedia(PipelineFormMedia):
js = ('extra1.js', 'extra2.js')

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

self.assertEqual(
MyMedia.js,
Expand All @@ -191,7 +194,7 @@ class MyMedia(PipelineFormMedia):
self.assertEqual(
media.render_js(),
[
'<script type="text/javascript" src="%s"></script>' % path
script_tag % path
for path in (
'/static/extra1.js',
'/static/extra2.js',
Expand Down
9 changes: 5 additions & 4 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[tox]
envlist =
pypy3-django{22,30}
py36-django{22,30,-master}
py37-django{22,30,-master}
py38-django{22,30,-master}
pypy3-django{22,30,31}
py36-django{22,30,31,-master}
py37-django{22,30,31,-master}
py38-django{22,30,31,-master}
docs

[testenv]
Expand All @@ -16,6 +16,7 @@ deps =
pypy3: mock
django22: Django>=2.2.1,<2.3
django30: Django>=3.0,<3.1
django31: Django>=3.1,<3.2
django-master: https://github.com/django/django/archive/master.tar.gz
jinja2
coverage
Expand Down

0 comments on commit f004181

Please sign in to comment.