From 1eafafd4517559ffdfd6cddc6022939d2b48c2d0 Mon Sep 17 00:00:00 2001 From: David Krauth Date: Sat, 13 Mar 2021 14:51:56 -1000 Subject: [PATCH] Drop support for Django 2.0, 2.1 and add support for 3.x; Python 3.8 --- .github/workflows/test.yml | 23 +++++++++++++++++++++++ .travis.yml | 21 --------------------- README.rst | 4 ++-- generic_plus/curation/forms.py | 4 ++-- generic_plus/forms/__init__.py | 2 +- generic_plus/models.py | 2 +- generic_plus/tests/test_curation/urls.py | 5 +---- setup.py | 7 ++++--- tox.ini | 15 ++++++++++----- 9 files changed, 44 insertions(+), 39 deletions(-) create mode 100644 .github/workflows/test.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..ee2d6eb --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,23 @@ +name: Test + +on: push + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: [3.7, 3.8] + + steps: + - uses: actions/checkout@v1 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install tox tox-gh-actions + - name: Test with tox + run: tox diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 148be95..0000000 --- a/.travis.yml +++ /dev/null @@ -1,21 +0,0 @@ -language: python - -matrix: - include: - - { python: 2.7, env: TOXENV=py27-dj111 } - - { python: 3.7, env: TOXENV=py37-dj111 } - - { python: 3.7, env: TOXENV=py37-dj20 } - - { python: 3.7, env: TOXENV=py37-dj21 } - - { python: 3.7, env: TOXENV=py37-dj22 } - - { python: 3.7, env: TOXENV=py37-dj30 } - -sudo: false - -cache: - pip: true - -install: - - pip install tox - -script: - - tox diff --git a/README.rst b/README.rst index 866cbb1..ce0494c 100644 --- a/README.rst +++ b/README.rst @@ -1,8 +1,8 @@ django-generic-plus ################### -.. image:: https://travis-ci.org/theatlantic/django-generic-plus.svg?branch=master - :target: https://travis-ci.org/theatlantic/django-generic-plus +.. image:: https://github.com/theatlantic/django-generic-plus/actions/workflows/test.yml/badge.svg + :target: https://github.com/theatlantic/django-generic-plus/actions :alt: Build Status **django-generic-plus** is a python module which provides a Django model diff --git a/generic_plus/curation/forms.py b/generic_plus/curation/forms.py index b106728..ef9c4e6 100644 --- a/generic_plus/curation/forms.py +++ b/generic_plus/curation/forms.py @@ -3,7 +3,7 @@ from django.forms import ValidationError from django.db import models from django.forms.models import ModelChoiceIterator -from django.utils.encoding import smart_text +from django.utils.encoding import smart_str from .widgets import ContentObjectSelect @@ -26,7 +26,7 @@ def choice(self, choice): "empty_label": None, "queryset": choice.get_queryset(), "prepare_value": self.field.prepare_value, - "label_from_instance": staticmethod(smart_text), + "label_from_instance": staticmethod(smart_str), "cache_choices": False, }) sub_choices = list(ModelChoiceIterator(fake_field)) diff --git a/generic_plus/forms/__init__.py b/generic_plus/forms/__init__.py index d4d863f..097fe40 100644 --- a/generic_plus/forms/__init__.py +++ b/generic_plus/forms/__init__.py @@ -10,7 +10,7 @@ from django.core.files.uploadedfile import UploadedFile from django.db import models from django.db.models.fields.files import FieldFile -from django.forms.forms import BoundField +from django.forms.boundfield import BoundField from django.forms.formsets import TOTAL_FORM_COUNT, DEFAULT_MAX_NUM from django.forms.models import modelform_factory, ModelFormMetaclass from django.utils.encoding import force_text diff --git a/generic_plus/models.py b/generic_plus/models.py index 64c0be8..38d06f1 100644 --- a/generic_plus/models.py +++ b/generic_plus/models.py @@ -11,7 +11,7 @@ def patch_django(): def patch_model_form(): from django.forms import BaseForm, Field - from django.forms.forms import BoundField + from django.forms.boundfield import BoundField from generic_plus.forms import GenericForeignFileFormField, GenericForeignFileBoundField if not hasattr(Field, 'get_bound_field'): diff --git a/generic_plus/tests/test_curation/urls.py b/generic_plus/tests/test_curation/urls.py index cb204e6..1cc9c53 100644 --- a/generic_plus/tests/test_curation/urls.py +++ b/generic_plus/tests/test_curation/urls.py @@ -6,7 +6,4 @@ import generic_plus.tests.test_curation.admin # noqa -if django.VERSION > (1, 9): - urlpatterns = [url(r'^admin/', admin.site.urls)] -else: - urlpatterns = [url(r'^admin/', include(admin.site.urls))] +urlpatterns = [url(r'^admin/', admin.site.urls)] diff --git a/setup.py b/setup.py index a58f9d5..f7d01a4 100755 --- a/setup.py +++ b/setup.py @@ -4,7 +4,7 @@ setup( name='django-generic-plus', - version="2.3.0", + version="2.4.0", install_requires=[ 'python-monkey-business>=1.0.0', ], @@ -25,15 +25,16 @@ 'Operating System :: OS Independent', 'Framework :: Django', 'Framework :: Django :: 1.11', - 'Framework :: Django :: 2.0', - 'Framework :: Django :: 2.1', 'Framework :: Django :: 2.2', 'Framework :: Django :: 3.0', + 'Framework :: Django :: 3.1', + 'Framework :: Django :: 3.2', 'Programming Language :: Python', "Programming Language :: Python :: 2", 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', ], include_package_data=True, zip_safe=False) diff --git a/tox.ini b/tox.ini index ba1f745..b8477f9 100644 --- a/tox.ini +++ b/tox.ini @@ -1,7 +1,7 @@ [tox] envlist = - py{27,37}-dj111 - py37-dj{20,21,22,30} + py27-dj111 + py{37,38}-dj{111,22,30,31,32} [testenv] commands = @@ -12,8 +12,13 @@ deps = six>=1.15 lxml dj-database-url - dj111: Django>=1.11.25,<2.0 - dj20: Django>=2.0,<2.1 - dj21: Django>=2.0,<2.1 + dj111: Django==1.11.29 dj22: Django>=2.2,<3.0 dj30: Django>=3.0,<3.1 + dj31: Django>=3.1,<3.2 + dj32: Django>=3.2b1,<4.0 + +[gh-actions] +python = + 3.7: py37 + 3.8: py38