diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index 7091202..2de41bb 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -17,6 +17,6 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install tox tox-gh-actions + python -m pip install tox tox-gh-actions - name: Test with tox run: tox diff --git a/README.md b/README.md index ef6ded7..8cb14f8 100644 --- a/README.md +++ b/README.md @@ -95,7 +95,7 @@ class SiteConfiguration(SingletonModel): Installation ------------ -This application requires Django 2.2, 3.1, or 3.2. +This application requires Django 2.2, 3.2, or 4.0. * Install the package using `pip install django-solo` * Add ``solo`` or ``solo.apps.SoloAppConfig`` to your ``INSTALLED_APPS`` setting. diff --git a/setup.py b/setup.py index 3068d60..b12b452 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ -from setuptools import setup, find_packages import os -import solo +import re +from setuptools import setup, find_packages README = os.path.join(os.path.dirname(__file__), 'README.md') @@ -12,11 +12,24 @@ except Exception: long_description = '' + +def get_version(package): + """ + Return package version as listed in `__version__` in `__init__.py`. + """ + with open(os.path.join(package, '__init__.py')) as file: + init_py = file.read() + return re.search("__version__ = ['\"]([^'\"]+)['\"]", init_py).group(1) + + +version = get_version('solo') + setup( name='django-solo', - version=solo.__version__, - description=solo.__doc__, + version=version, + description='Django Solo helps working with singletons', python_requires='>=3.6', + install_requires=['django>=2.2'], packages=find_packages(), url='https://github.com/lazybird/django-solo/', author='lazybird', @@ -27,8 +40,8 @@ license='Creative Commons Attribution 3.0 Unported', classifiers=[ 'Framework :: Django :: 2.2', - 'Framework :: Django :: 3.1', 'Framework :: Django :: 3.2', + 'Framework :: Django :: 4.0', 'Intended Audience :: Developers', 'Operating System :: OS Independent', 'Programming Language :: Python', diff --git a/solo/__init__.py b/solo/__init__.py index 4c4c5b3..870356c 100644 --- a/solo/__init__.py +++ b/solo/__init__.py @@ -4,7 +4,6 @@ __version__ = '1.2.0' -__doc__ = 'Django Solo helps working with singletons' if django.VERSION < (3, 2): default_app_config = 'solo.apps.SoloAppConfig' diff --git a/solo/admin.py b/solo/admin.py index accaeb2..a811537 100644 --- a/solo/admin.py +++ b/solo/admin.py @@ -1,16 +1,12 @@ from django.urls import re_path from django.contrib import admin from django.http import HttpResponseRedirect +from django.utils.encoding import force_str +from django.utils.translation import gettext as _ from solo.models import DEFAULT_SINGLETON_INSTANCE_ID from solo import settings as solo_settings -try: - from django.utils.encoding import force_unicode -except ImportError: - from django.utils.encoding import force_text as force_unicode -from django.utils.translation import ugettext as _ - class SingletonModelAdmin(admin.ModelAdmin): object_history_template = "admin/solo/object_history.html" @@ -56,7 +52,7 @@ def get_urls(self): def response_change(self, request, obj): msg = _('%(obj)s was changed successfully.') % { - 'obj': force_unicode(obj)} + 'obj': force_str(obj)} if '_continue' in request.POST: self.message_user(request, msg + ' ' + _('You may edit it again below.')) diff --git a/solo/templatetags/solo_tags.py b/solo/templatetags/solo_tags.py index 530ec0e..de0cdfe 100644 --- a/solo/templatetags/solo_tags.py +++ b/solo/templatetags/solo_tags.py @@ -1,5 +1,5 @@ from django import template -from django.utils.translation import ugettext as _ +from django.utils.translation import gettext as _ from solo import settings as solo_settings diff --git a/tox.ini b/tox.ini index 70fc906..e70b509 100644 --- a/tox.ini +++ b/tox.ini @@ -1,20 +1,21 @@ # Configure which test environments are run for each Github Actions Python version. [gh-actions] python = - 3.6: py36 - 3.7: py37 - 3.8: py38 - 3.9: py39 - 3.10: py310 + 3.6: py36-django{22,32} + 3.7: py37-django{22,32} + 3.8: py38-django{22,32,40} + 3.9: py39-django{22,32,40} + 3.10: py310-django{22,32,40} [tox] envlist = - py{36,37,38,39,310}-django{22,31,32} + py{36,37}-django{22,32} + py{38,39,310}-django{22,32,40} [testenv] deps = - django22: Django>=2.2,<2.3 - django31: Django>=3.1,<3.2 - django32: Django>=3.2,<3.3 + django22: Django>=2.2,<3.0 + django32: Django>=3.2,<4.0 + django40: Django>=4.0,<4.1 commands = {envpython} {toxinidir}/manage.py test solo --settings=solo.tests.settings