From e51fba45f8c2b842b7645075d78df28b1f576316 Mon Sep 17 00:00:00 2001 From: areski Date: Tue, 13 Dec 2022 18:55:29 +0100 Subject: [PATCH 1/4] [fix] support django-4.1 --- .travis.yml | 12 ++++++++++++ README.rst | 6 +++--- more_admin_filters/filters.py | 1 - setup.py | 5 ++++- tests/testapp/urls.py | 4 ++-- tox.ini | 4 ++++ 6 files changed, 25 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7970b1f..1406bf0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -51,8 +51,20 @@ matrix: env: REQ="Django>=3.1,<3.2" - python: "3.8" env: REQ="Django>=3.2,<3.3" + - python: "3.8" + env: REQ="Django>=4.0,<4.1" + - python: "3.8" + env: REQ="Django>=4.1,<4.2" - python: "3.9" env: REQ="Django>=3.2,<3.3" + - python: "3.9" + env: REQ="Django>=4.0,<4.1" + - python: "3.9" + env: REQ="Django>=4.1,<4.2" + - python: "3.10" + env: REQ="Django>=4.1,<4.2" + - python: "3.11" + env: REQ="Django>=4.1,<4.2" before_install: - sudo apt-get -y install firefox-geckodriver install: diff --git a/README.rst b/README.rst index c549a55..39909c4 100644 --- a/README.rst +++ b/README.rst @@ -4,17 +4,17 @@ Welcome to django-more-admin-filters .. image:: https://travis-ci.com/thomst/django-more-admin-filters.svg?branch=master :target: https://travis-ci.com/thomst/django-more-admin-filters - + .. image:: https://coveralls.io/repos/github/thomst/django-more-admin-filters/badge.svg?branch=master :target: https://coveralls.io/github/thomst/django-more-admin-filters?branch=master .. image:: https://img.shields.io/badge/python-3.5%20%7C%203.6%20%7C%203.7%20%7C%203.8%20%7C%203.9-blue :target: https://img.shields.io/badge/python-3.5%20%7C%203.6%20%7C%203.7%20%7C%203.8%20%7C%203.9-blue - :alt: python: 3.5, 3.6, 3.7, 3.8, 3.9 + :alt: python: 3.5, 3.6, 3.7, 3.8, 3.9, 3.10, 3.11 .. image:: https://img.shields.io/badge/django-1.11%20%7C%202.0%20%7C%202.1%20%7C%202.2%20%7C%203.0%20%7C%203.1%20%7C%203.2-orange :target: https://img.shields.io/badge/django-1.11%20%7C%202.0%20%7C%202.1%20%7C%202.2%20%7C%203.0%20%7C%203.1%20%7C%203.2-orange - :alt: django: 1.11, 2.0, 2.1, 2.2, 3.0, 3.1, 3.2 + :alt: django: 1.11, 2.0, 2.1, 2.2, 3.0, 3.1, 3.2, 4.0, 4.1 Description diff --git a/more_admin_filters/filters.py b/more_admin_filters/filters.py index 8a41b54..145c473 100644 --- a/more_admin_filters/filters.py +++ b/more_admin_filters/filters.py @@ -2,7 +2,6 @@ from django.contrib.admin.utils import prepare_lookup_value from django.contrib import admin from django.db.models import Q -from django.utils.encoding import force_text from django.utils.translation import gettext_lazy as _ from django.contrib.admin.utils import reverse_field_path from django.contrib.admin.utils import get_model_from_relation diff --git a/setup.py b/setup.py index 1cc2bef..53ea8c8 100644 --- a/setup.py +++ b/setup.py @@ -32,7 +32,7 @@ setup( packages=find_packages(exclude=["tests"]), include_package_data=True, install_requires=[ - "Django>=1.11,<3.3", + "Django>=1.11,<=4.1", ], classifiers=[ dev_status, @@ -48,6 +48,9 @@ setup( "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", "Topic :: Internet :: WWW/HTTP :: Dynamic Content", "Topic :: Software Development", "Topic :: Software Development :: Libraries :: Application Frameworks", diff --git a/tests/testapp/urls.py b/tests/testapp/urls.py index c242ced..5b692c8 100644 --- a/tests/testapp/urls.py +++ b/tests/testapp/urls.py @@ -14,8 +14,8 @@ Including another URLconf 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ from django.contrib import admin -from django.conf.urls import url +from django.urls import re_path urlpatterns = [ - url(r'^admin/', admin.site.urls), + re_path(r'^admin/', admin.site.urls), ] diff --git a/tox.ini b/tox.ini index 4e8584c..d54deab 100644 --- a/tox.ini +++ b/tox.ini @@ -12,6 +12,8 @@ envlist = {py36,py37,py38}-django30, {py36,py37,py38}-django31, {py36,py37,py38,py39}-django32 + {py38,py39}-django40 + {py38,py39,py310,py311}-django41 skip_missing_interpreters = true [testenv] @@ -23,6 +25,8 @@ deps = django30: Django>=3.0,<3.1 django31: Django>=3.1,<3.2 django32: Django>=3.2,<3.3 + django40: Django>=4.0,<4.1 + django41: Django>=4.1,<4.2 selenium commands = {envpython} tests/manage.py test testapp {posargs} From ad3b0af66ae7498c9df7d2c5125763b5ec862421 Mon Sep 17 00:00:00 2001 From: areski Date: Wed, 14 Dec 2022 12:28:57 +0100 Subject: [PATCH 2/4] [fix] move version from __init__ to avoid install conflict when django is not yet installed --- more_admin_filters/__init__.py | 16 +++++++++------- more_admin_filters/__version__.py | 16 ++++++++++++++++ setup.py | 22 +++++++++++++++------- 3 files changed, 40 insertions(+), 14 deletions(-) create mode 100644 more_admin_filters/__version__.py diff --git a/more_admin_filters/__init__.py b/more_admin_filters/__init__.py index d1599d8..00c2a1e 100644 --- a/more_admin_filters/__init__.py +++ b/more_admin_filters/__init__.py @@ -1,9 +1,11 @@ -VERSION = (1, 3) -__version__ = ".".join(map(str, VERSION)) - - from .filters import ( - MultiSelectFilter, MultiSelectRelatedFilter, MultiSelectRelatedOnlyFilter, - MultiSelectDropdownFilter, MultiSelectRelatedDropdownFilter, DropdownFilter, - ChoicesDropdownFilter, RelatedDropdownFilter, BooleanAnnotationFilter + MultiSelectFilter, + MultiSelectRelatedFilter, + MultiSelectRelatedOnlyFilter, + MultiSelectDropdownFilter, + MultiSelectRelatedDropdownFilter, + DropdownFilter, + ChoicesDropdownFilter, + RelatedDropdownFilter, + BooleanAnnotationFilter, ) diff --git a/more_admin_filters/__version__.py b/more_admin_filters/__version__.py new file mode 100644 index 0000000..43959e9 --- /dev/null +++ b/more_admin_filters/__version__.py @@ -0,0 +1,16 @@ +""" +This project uses the Semantic Versioning scheme in conjunction with PEP 0440: + + + +Major versions introduce significant changes to the API, and backwards +compatibility is not guaranteed. Minor versions are for new features and other +backwards-compatible changes to the API. Patch versions are for bug fixes and +internal code changes that do not affect the API. Development versions are +incomplete states of a release . + +Version 0.x should be considered a development version with an unstable API, +and backwards compatibility is not guaranteed for minor versions. +""" + +__version__ = "1.3" diff --git a/setup.py b/setup.py index 53ea8c8..8eb8098 100644 --- a/setup.py +++ b/setup.py @@ -3,6 +3,15 @@ import os from setuptools import setup from setuptools import find_packages +from pathlib import Path + + +def version(): + """Get the local package version.""" + namespace = {} + path = Path("more_admin_filters", "__version__.py") + exec(path.read_text(), namespace) + return namespace["__version__"] def read(filename): @@ -11,18 +20,17 @@ def read(filename): return file.read() -version = __import__("more_admin_filters").__version__ -if '-dev' in version: - dev_status = 'Development Status :: 3 - Alpha' -elif '-beta' in version: - dev_status = 'Development Status :: 4 - Beta' +if "-dev" in version: + dev_status = "Development Status :: 3 - Alpha" +elif "-beta" in version: + dev_status = "Development Status :: 4 - Beta" else: - dev_status = 'Development Status :: 5 - Production/Stable' + dev_status = "Development Status :: 5 - Production/Stable" setup( name="django-more-admin-filters", - version=version, + version=version(), description="Additional filters for django-admin.", long_description=read("README.rst"), author="Thomas Leichtfuß", From b14837be9a89920fcfdd935eaa00acf46b9580ef Mon Sep 17 00:00:00 2001 From: areski Date: Wed, 14 Dec 2022 12:34:40 +0100 Subject: [PATCH 3/4] [fix] fix version --- setup.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 8eb8098..f71a6e1 100644 --- a/setup.py +++ b/setup.py @@ -20,6 +20,7 @@ def read(filename): return file.read() +version = version() if "-dev" in version: dev_status = "Development Status :: 3 - Alpha" elif "-beta" in version: @@ -30,7 +31,7 @@ else: setup( name="django-more-admin-filters", - version=version(), + version=version, description="Additional filters for django-admin.", long_description=read("README.rst"), author="Thomas Leichtfuß", From 28e047650b483203d0dff896ee8a3a1036a03f4a Mon Sep 17 00:00:00 2001 From: areski Date: Wed, 14 Dec 2022 12:51:43 +0100 Subject: [PATCH 4/4] [fix] fix required version of django <4.2 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index f71a6e1..86e2a88 100644 --- a/setup.py +++ b/setup.py @@ -41,7 +41,7 @@ setup( packages=find_packages(exclude=["tests"]), include_package_data=True, install_requires=[ - "Django>=1.11,<=4.1", + "Django>=1.11,<4.2", ], classifiers=[ dev_status,