Skip to content

Commit

Permalink
Add Django 3.1 support (django-cms#1201)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
FinalAngel and jrief authored Sep 2, 2020
1 parent d45a9a2 commit 42ca9f3
Show file tree
Hide file tree
Showing 126 changed files with 296 additions and 647 deletions.
34 changes: 19 additions & 15 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
language: python

dist: xenial
sudo: false

matrix:
include:
Expand All @@ -13,29 +12,33 @@ matrix:
env: TOX_ENV='docs'
- python: 3.6
env: TOX_ENV='frontend'
# Django 1.11
- python: 3.4
env: DJANGO='dj111' SWAP='noswap'
# Django 2.2
- python: 3.5
env: DJANGO='dj111' SWAP='noswap'
- python: 3.6
env: DJANGO='dj111' SWAP='noswap'
env: DJANGO='dj22' SWAP='swap'
- python: 3.6
env: DJANGO='dj111' SWAP='swap'
# Django 2.2
- python: 3.7
env: DJANGO='dj22' SWAP='noswap'
- python: 3.8
env: DJANGO='dj22' SWAP='swap'
# Django 3.0
- python: 3.7
env: DJANGO='dj30' SWAP='noswap'
env: DJANGO='dj22' SWAP='swap'
- python: 3.8
env: DJANGO='dj22' SWAP='noswap'
# Django 3.0, always run the lowest supported version
- python: 3.6
env: DJANGO='dj30' SWAP='swap'
- python: 3.6
env: DJANGO='dj30' SWAP='noswap'
# Django 3.1, always run the lowest supported version
- python: 3.6
env: DJANGO='dj31' SWAP='swap'
- python: 3.6
env: DJANGO='dj31' SWAP='noswap'
allow_failures:
- python: 3.6
env: DJANGO='dj31' SWAP='swap'
- python: 3.6
env: DJANGO='dj31' SWAP='noswap'

install:
- pip install coverage isort tox
- "if [[ $TRAVIS_PYTHON_VERSION == '3.4' ]]; then export PY_VER=py34; fi"
- "if [[ $TRAVIS_PYTHON_VERSION == '3.5' ]]; then export PY_VER=py35; fi"
- "if [[ $TRAVIS_PYTHON_VERSION == '3.6' ]]; then export PY_VER=py36; fi"
- "if [[ $TRAVIS_PYTHON_VERSION == '3.7' ]]; then export PY_VER=py37; fi"
Expand All @@ -44,6 +47,7 @@ install:

before_script:
- if [ $TOX_ENV == 'frontend' ]; then
pip install -r tests/requirements/frontend.txt;
nvm install 0.12.7 && nvm use 0.12.7;
npm config set spin false;
npm install -g npm@2;
Expand Down
8 changes: 6 additions & 2 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@
CHANGELOG
=========

Next Version
============

2.0.0 (unreleased)
==================

* Added support for Django 3.1
* Dropped support for Python 2.7 and Python 3.4
* Dropped support for Django < 2.2
* Changed the preferred way to do model registration via model inheritance
and ``mptt.AlreadyRegistered``, which is deprecated since django-mptt 0.4

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
include LICENSE.txt
include LICENSE
include README.rst
recursive-include filer/locale *
recursive-include filer/static *
Expand Down
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ for all the details on how to install, configure and use django-filer.
.. |coverage| image:: https://codecov.io/gh/divio/django-filer/branch/master/graph/badge.svg
:target: https://codecov.io/gh/divio/django-filer

.. |python| image:: https://img.shields.io/badge/python-2.7%20%7C%203.4+-blue.svg
.. |python| image:: https://img.shields.io/badge/python-3.5+-blue.svg
:target: https://pypi.org/project/django-filer/
.. |django| image:: https://img.shields.io/badge/django-1.11%20%7C%202.1%20%7C%202.2-blue.svg
.. |django| image:: https://img.shields.io/badge/django-2.2,%203.0,%203.1-blue.svg
:target: https://www.djangoproject.com/
1 change: 0 additions & 1 deletion aldryn_config.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from aldryn_client import forms


Expand Down
8 changes: 4 additions & 4 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
#
# django-filer documentation build configuration file, created by
# sphinx-quickstart on Tue Nov 16 22:05:55 2010.
Expand All @@ -11,12 +10,13 @@
# All configuration values have a default; values that are commented out
# serve to show the default.

import sys, os
sys.path.append(os.path.abspath('../'))
import datetime
import os
import sys

from filer import __version__
sys.path.append(os.path.abspath('../'))

from filer import __version__

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
Expand Down
6 changes: 3 additions & 3 deletions docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ The easiest way to get ``django-filer`` is simply install it with `pip`_::
Dependencies
------------

* `Django`_ >= 1.11
* `Django`_ >= 2.2
* `django-mptt`_ >=0.6
* `easy_thumbnails`_ >= 2.0
* `django-polymorphic`_ >= 0.7
Expand All @@ -28,9 +28,9 @@ check `Pillow doc`_.

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

* for `Django`_ >=1.8,<1.11 use `django-polymorphic`_ 1.3.1
* for `Django`_ >=1.11 use `django-polymorphic`_ >=2.0
* for `Django`_ >=2.2 use `django-polymorphic`_ >=2.0
* for `Django`_ >=3.0 use `django-polymorphic`_ >=2.1
* for `Django`_ >=3.1 use `django-polymorphic`_ >=3.0

Configuration
-------------
Expand Down
1 change: 0 additions & 1 deletion filer/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
"""
See PEP 386 (https://www.python.org/dev/peps/pep-0386/)
Expand Down
1 change: 0 additions & 1 deletion filer/admin/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from django.contrib import admin

from ..models import Clipboard, File, Folder, FolderPermission, ThumbnailOption
Expand Down
37 changes: 17 additions & 20 deletions filer/admin/clipboardadmin.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import

from django.conf.urls import url
from django.contrib import admin
from django.forms.models import modelform_factory
from django.http import JsonResponse
from django.urls import re_path
from django.views.decorators.csrf import csrf_exempt

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

def get_urls(self):
return [
url(r'^operations/paste_clipboard_to_folder/$',
self.admin_site.admin_view(views.paste_clipboard_to_folder),
name='filer-paste_clipboard_to_folder'),
url(r'^operations/discard_clipboard/$',
self.admin_site.admin_view(views.discard_clipboard),
name='filer-discard_clipboard'),
url(r'^operations/delete_clipboard/$',
self.admin_site.admin_view(views.delete_clipboard),
name='filer-delete_clipboard'),
url(r'^operations/upload/(?P<folder_id>[0-9]+)/$',
ajax_upload,
name='filer-ajax_upload'),
url(r'^operations/upload/no_folder/$',
ajax_upload,
name='filer-ajax_upload'),
] + super(ClipboardAdmin, self).get_urls()
re_path(r'^operations/paste_clipboard_to_folder/$',
self.admin_site.admin_view(views.paste_clipboard_to_folder),
name='filer-paste_clipboard_to_folder'),
re_path(r'^operations/discard_clipboard/$',
self.admin_site.admin_view(views.discard_clipboard),
name='filer-discard_clipboard'),
re_path(r'^operations/delete_clipboard/$',
self.admin_site.admin_view(views.delete_clipboard),
name='filer-delete_clipboard'),
re_path(r'^operations/upload/(?P<folder_id>[0-9]+)/$',
ajax_upload,
name='filer-ajax_upload'),
re_path(r'^operations/upload/no_folder/$',
ajax_upload,
name='filer-ajax_upload'),
] + super().get_urls()

def get_model_perms(self, *args, **kwargs):
"""
Expand Down
15 changes: 6 additions & 9 deletions filer/admin/fileadmin.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import

from django import forms
from django.contrib.admin.utils import unquote
from django.http import HttpResponseRedirect
from django.urls import reverse
from django.utils.safestring import mark_safe
from django.utils.translation import ugettext as _
from django.utils.translation import gettext as _

from .. import settings
from ..models import File
Expand All @@ -15,7 +12,7 @@


class FileAdminChangeFrom(forms.ModelForm):
class Meta(object):
class Meta:
model = File
exclude = ()

Expand Down Expand Up @@ -82,7 +79,7 @@ def response_change(self, request, obj):
admin_url_params_encoded(request),
)
return HttpResponseRedirect(url)
return super(FileAdmin, self).response_change(request, obj)
return super().response_change(request, obj)

def render_change_form(self, request, context, add=False, change=False,
form_url='', obj=None):
Expand All @@ -92,7 +89,7 @@ def render_change_form(self, request, context, add=False, change=False,
'is_popup': popup_status(request),
'filer_admin_context': AdminContext(request)}
context.update(extra_context)
return super(FileAdmin, self).render_change_form(
return super().render_change_form(
request=request, context=context, add=add, change=change,
form_url=form_url, obj=obj)

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

if request.POST:
# Return to folder listing, since there is no usable file listing.
super(FileAdmin, self).delete_view(
super().delete_view(
request=request, object_id=object_id,
extra_context=extra_context)
if parent_folder:
Expand All @@ -127,7 +124,7 @@ def delete_view(self, request, object_id, extra_context=None):
)
return HttpResponseRedirect(url)

return super(FileAdmin, self).delete_view(
return super().delete_view(
request=request, object_id=object_id,
extra_context=extra_context)

Expand Down
Loading

0 comments on commit 42ca9f3

Please sign in to comment.