Skip to content

Commit

Permalink
Drop support for old versions of Python and Django
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiask committed Jan 16, 2022
1 parent 7e6ae3a commit dac3ac9
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 77 deletions.
17 changes: 0 additions & 17 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ jobs:
fail-fast: false
matrix:
python-version:
- "3.6"
- "3.7"
- "3.8"
- "3.9"
- "3.10"
Expand All @@ -33,18 +31,3 @@ jobs:
run: |
ENV_PREFIX=$(tr -C -d "0-9" <<< "${{ matrix.python-version }}")
TOXENV=$(tox --listenvs | grep "^py$ENV_PREFIX" | tr '\n' ',') python -m tox
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install dependencies
run: |
python -m pip install --upgrade pip tox
- name: Run lint
run: tox -e style
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Change log
- Specified the default ``AutoField`` for django-cabinet to avoid migrations.
- Added an additional safeguard against unhandleable images.
- Fixed the ``default_app_config`` deprecation warning.
- Raised the minimum versions of Python to 3.2 and Django to 3.8.


`0.11`_ (2020-09-12)
Expand Down
8 changes: 0 additions & 8 deletions cabinet/__init__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,2 @@
VERSION = (0, 11, 6)
__version__ = ".".join(map(str, VERSION))

try:
import django
except ModuleNotFoundError:
pass
else:
if django.VERSION < (3, 2):
default_app_config = "cabinet.apps.CabinetConfig"
28 changes: 6 additions & 22 deletions cabinet/base_admin.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
from urllib.parse import urlencode

import django
from django import forms
from django.contrib import admin, messages
from django.contrib.admin import helpers
from django.contrib.admin.options import IncorrectLookupParameters
from django.contrib.admin.utils import get_deleted_objects
from django.contrib.admin.views.main import SEARCH_VAR
from django.core.exceptions import FieldDoesNotExist, PermissionDenied, ValidationError
from django.db import router, transaction
Expand Down Expand Up @@ -222,28 +220,14 @@ def _folder_form_delete(self, request, obj):
if not self.has_delete_permission(request, obj):
raise PermissionDenied

using = router.db_for_write(obj.__class__)

# Populate deleted_objects, a data structure of all related objects
# that will also be deleted.
if django.VERSION < (2, 1):
(
deleted_objects,
model_count,
perms_needed,
protected,
) = get_deleted_objects( # noqa
[obj], obj._meta, request.user, self.admin_site, using
)
else:
(
deleted_objects,
model_count,
perms_needed,
protected,
) = self.get_deleted_objects(
[obj], request
) # noqa
(
deleted_objects,
model_count,
perms_needed,
protected,
) = self.get_deleted_objects([obj], request)

if protected or perms_needed:
self.message_user(
Expand Down
18 changes: 5 additions & 13 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,20 @@ classifiers =
Operating System :: OS Independent
Programming Language :: Python
Programming Language :: Python :: 3
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Topic :: Internet :: WWW/HTTP :: Dynamic Content
Topic :: Software Development
Topic :: Software Development :: Libraries :: Application Frameworks

[options]
packages = find:
install_requires =
Django>=3.2
django-imagefield
django-tree-queries
python_requires = >=3.8
include_package_data = True
zip_safe = False

Expand All @@ -37,19 +42,6 @@ tests =
[options.packages.find]
exclude = tests

[flake8]
exclude = venv,build,docs,.tox,migrations
max-complexity = 10
max-line-length = 88

[bdist_wheel]
universal = 1

[isort]
profile = black
combine_as_imports = True
lines_after_imports = 2

[coverage:run]
branch = True
include =
Expand Down
17 changes: 0 additions & 17 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
[tox]
envlist =
py{36,37,38,39}-dj{22,30,31}
py{38,39,310}-dj{32,40,main}
docs
style

[testenv]
usedevelop = true
Expand All @@ -12,25 +10,10 @@ commands =
python -Wd {envbindir}/coverage run tests/manage.py test -v2 --keepdb {posargs:testapp}
coverage report -m
deps =
dj22: Django>=2.2,<3.0
dj30: Django>=3.0,<3.1
dj31: Django>=3.1,<3.2
dj32: Django>=3.2,<4.0
dj40: Django>=4.0,<4.1
djmain: https://github.com/django/django/archive/main.tar.gz

[testenv:style]
deps =
black
flake8
isort
changedir = {toxinidir}
commands =
isort setup.py cabinet tests
black .
flake8 .
skip_install = true

[testenv:docs]
deps =
Sphinx
Expand Down

0 comments on commit dac3ac9

Please sign in to comment.