Skip to content

Commit 42ca9f3

Browse files
FinalAngeljrief
andauthored
Add Django 3.1 support (django-cms#1201)
* lift the setup.py restrictions * update files * fix isort * add further fixes * update app helper * fix docs * fix last issues * update docs :) * Remove Python-2 legacy (django-cms#1178) * remove all occurences of six * remove all occurences of __future__ * also adopt for all unit tests * remove six as external dependency * fix isort complaints * no need to inherit from ‘object’ in Python-3 * use Python-3 super() style * further adaptions * additional fixes fom comments * fix tests * fix isort * I give up on the integration tests * well fe tests can still be enabled :) * move the comma to the comment * add depth again * fix 3.1 issue * fix windowname_to_id * updates * compare in lowercase for certain dbs * fixes docs? * update polymorphic version * update docs * rename license file Co-authored-by: Jacob Rief <[email protected]>
1 parent d45a9a2 commit 42ca9f3

File tree

126 files changed

+296
-647
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

126 files changed

+296
-647
lines changed

.travis.yml

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
language: python
22

33
dist: xenial
4-
sudo: false
54

65
matrix:
76
include:
@@ -13,29 +12,33 @@ matrix:
1312
env: TOX_ENV='docs'
1413
- python: 3.6
1514
env: TOX_ENV='frontend'
16-
# Django 1.11
17-
- python: 3.4
18-
env: DJANGO='dj111' SWAP='noswap'
15+
# Django 2.2
1916
- python: 3.5
20-
env: DJANGO='dj111' SWAP='noswap'
21-
- python: 3.6
22-
env: DJANGO='dj111' SWAP='noswap'
17+
env: DJANGO='dj22' SWAP='swap'
2318
- python: 3.6
24-
env: DJANGO='dj111' SWAP='swap'
25-
# Django 2.2
26-
- python: 3.7
2719
env: DJANGO='dj22' SWAP='noswap'
28-
- python: 3.8
29-
env: DJANGO='dj22' SWAP='swap'
30-
# Django 3.0
3120
- python: 3.7
32-
env: DJANGO='dj30' SWAP='noswap'
21+
env: DJANGO='dj22' SWAP='swap'
3322
- python: 3.8
23+
env: DJANGO='dj22' SWAP='noswap'
24+
# Django 3.0, always run the lowest supported version
25+
- python: 3.6
3426
env: DJANGO='dj30' SWAP='swap'
27+
- python: 3.6
28+
env: DJANGO='dj30' SWAP='noswap'
29+
# Django 3.1, always run the lowest supported version
30+
- python: 3.6
31+
env: DJANGO='dj31' SWAP='swap'
32+
- python: 3.6
33+
env: DJANGO='dj31' SWAP='noswap'
34+
allow_failures:
35+
- python: 3.6
36+
env: DJANGO='dj31' SWAP='swap'
37+
- python: 3.6
38+
env: DJANGO='dj31' SWAP='noswap'
3539

3640
install:
3741
- pip install coverage isort tox
38-
- "if [[ $TRAVIS_PYTHON_VERSION == '3.4' ]]; then export PY_VER=py34; fi"
3942
- "if [[ $TRAVIS_PYTHON_VERSION == '3.5' ]]; then export PY_VER=py35; fi"
4043
- "if [[ $TRAVIS_PYTHON_VERSION == '3.6' ]]; then export PY_VER=py36; fi"
4144
- "if [[ $TRAVIS_PYTHON_VERSION == '3.7' ]]; then export PY_VER=py37; fi"
@@ -44,6 +47,7 @@ install:
4447

4548
before_script:
4649
- if [ $TOX_ENV == 'frontend' ]; then
50+
pip install -r tests/requirements/frontend.txt;
4751
nvm install 0.12.7 && nvm use 0.12.7;
4852
npm config set spin false;
4953
npm install -g npm@2;

CHANGELOG.rst

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,13 @@
22
CHANGELOG
33
=========
44

5-
Next Version
6-
============
75

6+
2.0.0 (unreleased)
7+
==================
8+
9+
* Added support for Django 3.1
10+
* Dropped support for Python 2.7 and Python 3.4
11+
* Dropped support for Django < 2.2
812
* Changed the preferred way to do model registration via model inheritance
913
and ``mptt.AlreadyRegistered``, which is deprecated since django-mptt 0.4
1014

LICENSE.txt renamed to LICENSE

File renamed without changes.

MANIFEST.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
include LICENSE.txt
1+
include LICENSE
22
include README.rst
33
recursive-include filer/locale *
44
recursive-include filer/static *

README.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ for all the details on how to install, configure and use django-filer.
5151
.. |coverage| image:: https://codecov.io/gh/divio/django-filer/branch/master/graph/badge.svg
5252
:target: https://codecov.io/gh/divio/django-filer
5353

54-
.. |python| image:: https://img.shields.io/badge/python-2.7%20%7C%203.4+-blue.svg
54+
.. |python| image:: https://img.shields.io/badge/python-3.5+-blue.svg
5555
:target: https://pypi.org/project/django-filer/
56-
.. |django| image:: https://img.shields.io/badge/django-1.11%20%7C%202.1%20%7C%202.2-blue.svg
56+
.. |django| image:: https://img.shields.io/badge/django-2.2,%203.0,%203.1-blue.svg
5757
:target: https://www.djangoproject.com/

aldryn_config.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# -*- coding: utf-8 -*-
21
from aldryn_client import forms
32

43

docs/conf.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# -*- coding: utf-8 -*-
21
#
32
# django-filer documentation build configuration file, created by
43
# sphinx-quickstart on Tue Nov 16 22:05:55 2010.
@@ -11,12 +10,13 @@
1110
# All configuration values have a default; values that are commented out
1211
# serve to show the default.
1312

14-
import sys, os
15-
sys.path.append(os.path.abspath('../'))
1613
import datetime
14+
import os
15+
import sys
1716

18-
from filer import __version__
17+
sys.path.append(os.path.abspath('../'))
1918

19+
from filer import __version__
2020

2121
# If extensions (or modules to document with autodoc) are in another directory,
2222
# add these directories to sys.path here. If the directory is relative to the

docs/installation.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ The easiest way to get ``django-filer`` is simply install it with `pip`_::
1414
Dependencies
1515
------------
1616

17-
* `Django`_ >= 1.11
17+
* `Django`_ >= 2.2
1818
* `django-mptt`_ >=0.6
1919
* `easy_thumbnails`_ >= 2.0
2020
* `django-polymorphic`_ >= 0.7
@@ -28,9 +28,9 @@ check `Pillow doc`_.
2828

2929
`django-polymorphic`_ version depends on `Django`_ version:
3030

31-
* for `Django`_ >=1.8,<1.11 use `django-polymorphic`_ 1.3.1
32-
* for `Django`_ >=1.11 use `django-polymorphic`_ >=2.0
31+
* for `Django`_ >=2.2 use `django-polymorphic`_ >=2.0
3332
* for `Django`_ >=3.0 use `django-polymorphic`_ >=2.1
33+
* for `Django`_ >=3.1 use `django-polymorphic`_ >=3.0
3434

3535
Configuration
3636
-------------

filer/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# -*- coding: utf-8 -*-
21
"""
32
See PEP 386 (https://www.python.org/dev/peps/pep-0386/)
43

filer/admin/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# -*- coding: utf-8 -*-
21
from django.contrib import admin
32

43
from ..models import Clipboard, File, Folder, FolderPermission, ThumbnailOption

filer/admin/clipboardadmin.py

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
1-
# -*- coding: utf-8 -*-
2-
from __future__ import absolute_import
3-
4-
from django.conf.urls import url
51
from django.contrib import admin
62
from django.forms.models import modelform_factory
73
from django.http import JsonResponse
4+
from django.urls import re_path
85
from django.views.decorators.csrf import csrf_exempt
96

107
from .. import settings as filer_settings
@@ -40,22 +37,22 @@ class ClipboardAdmin(admin.ModelAdmin):
4037

4138
def get_urls(self):
4239
return [
43-
url(r'^operations/paste_clipboard_to_folder/$',
44-
self.admin_site.admin_view(views.paste_clipboard_to_folder),
45-
name='filer-paste_clipboard_to_folder'),
46-
url(r'^operations/discard_clipboard/$',
47-
self.admin_site.admin_view(views.discard_clipboard),
48-
name='filer-discard_clipboard'),
49-
url(r'^operations/delete_clipboard/$',
50-
self.admin_site.admin_view(views.delete_clipboard),
51-
name='filer-delete_clipboard'),
52-
url(r'^operations/upload/(?P<folder_id>[0-9]+)/$',
53-
ajax_upload,
54-
name='filer-ajax_upload'),
55-
url(r'^operations/upload/no_folder/$',
56-
ajax_upload,
57-
name='filer-ajax_upload'),
58-
] + super(ClipboardAdmin, self).get_urls()
40+
re_path(r'^operations/paste_clipboard_to_folder/$',
41+
self.admin_site.admin_view(views.paste_clipboard_to_folder),
42+
name='filer-paste_clipboard_to_folder'),
43+
re_path(r'^operations/discard_clipboard/$',
44+
self.admin_site.admin_view(views.discard_clipboard),
45+
name='filer-discard_clipboard'),
46+
re_path(r'^operations/delete_clipboard/$',
47+
self.admin_site.admin_view(views.delete_clipboard),
48+
name='filer-delete_clipboard'),
49+
re_path(r'^operations/upload/(?P<folder_id>[0-9]+)/$',
50+
ajax_upload,
51+
name='filer-ajax_upload'),
52+
re_path(r'^operations/upload/no_folder/$',
53+
ajax_upload,
54+
name='filer-ajax_upload'),
55+
] + super().get_urls()
5956

6057
def get_model_perms(self, *args, **kwargs):
6158
"""

filer/admin/fileadmin.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
1-
# -*- coding: utf-8 -*-
2-
from __future__ import absolute_import
3-
41
from django import forms
52
from django.contrib.admin.utils import unquote
63
from django.http import HttpResponseRedirect
74
from django.urls import reverse
85
from django.utils.safestring import mark_safe
9-
from django.utils.translation import ugettext as _
6+
from django.utils.translation import gettext as _
107

118
from .. import settings
129
from ..models import File
@@ -15,7 +12,7 @@
1512

1613

1714
class FileAdminChangeFrom(forms.ModelForm):
18-
class Meta(object):
15+
class Meta:
1916
model = File
2017
exclude = ()
2118

@@ -82,7 +79,7 @@ def response_change(self, request, obj):
8279
admin_url_params_encoded(request),
8380
)
8481
return HttpResponseRedirect(url)
85-
return super(FileAdmin, self).response_change(request, obj)
82+
return super().response_change(request, obj)
8683

8784
def render_change_form(self, request, context, add=False, change=False,
8885
form_url='', obj=None):
@@ -92,7 +89,7 @@ def render_change_form(self, request, context, add=False, change=False,
9289
'is_popup': popup_status(request),
9390
'filer_admin_context': AdminContext(request)}
9491
context.update(extra_context)
95-
return super(FileAdmin, self).render_change_form(
92+
return super().render_change_form(
9693
request=request, context=context, add=add, change=change,
9794
form_url=form_url, obj=obj)
9895

@@ -113,7 +110,7 @@ def delete_view(self, request, object_id, extra_context=None):
113110

114111
if request.POST:
115112
# Return to folder listing, since there is no usable file listing.
116-
super(FileAdmin, self).delete_view(
113+
super().delete_view(
117114
request=request, object_id=object_id,
118115
extra_context=extra_context)
119116
if parent_folder:
@@ -127,7 +124,7 @@ def delete_view(self, request, object_id, extra_context=None):
127124
)
128125
return HttpResponseRedirect(url)
129126

130-
return super(FileAdmin, self).delete_view(
127+
return super().delete_view(
131128
request=request, object_id=object_id,
132129
extra_context=extra_context)
133130

0 commit comments

Comments
 (0)