diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7d52064..76317ed 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -8,7 +8,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: [3.6, 3.7, 3.8, 3.9] + python-version: ["3.7", "3.8", "3.9", "3.10", "pypy-3.7", "pypy-3.8"] steps: - uses: actions/checkout@v1 diff --git a/.gitignore b/.gitignore index dd56309..7190a6b 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,4 @@ tests/db.sqlite* /tests/local.db /.venv .vscode/settings.json +pyrightconfig.json diff --git a/advanced_filters/forms.py b/advanced_filters/forms.py index e14794f..0ffe761 100644 --- a/advanced_filters/forms.py +++ b/advanced_filters/forms.py @@ -14,7 +14,6 @@ from django.db.models import Q from django.db.models.fields import DateField from django.forms.formsets import formset_factory, BaseFormSet -from django.utils.functional import cached_property from functools import reduce from django.utils.text import capfirst from django.utils.translation import gettext_lazy as _ @@ -200,14 +199,6 @@ def get_form_kwargs(self, index): kwargs['model_fields'] = self.model_fields return kwargs - @cached_property - def forms(self): - # override the original property to include `model_fields` argument - forms = [self._construct_form(i, model_fields=self.model_fields) - for i in range(self.total_form_count())] - forms.append(self.empty_form) # add initial empty form - return forms - AFQFormSet = formset_factory( AdvancedFilterQueryForm, formset=AdvancedFilterFormSet, diff --git a/advanced_filters/urls.py b/advanced_filters/urls.py index a8fd76e..4fc8320 100644 --- a/advanced_filters/urls.py +++ b/advanced_filters/urls.py @@ -1,14 +1,14 @@ -from django.conf.urls import url +from django.urls import path from advanced_filters.views import GetFieldChoices urlpatterns = [ - url(r'^field_choices/(?P.+)/(?P.+)/?', + path('field_choices///', GetFieldChoices.as_view(), name='afilters_get_field_choices'), # only to allow building dynamically - url(r'^field_choices/$', + path('field_choices/', GetFieldChoices.as_view(), name='afilters_get_field_choices'), ] diff --git a/setup.py b/setup.py index fd1272f..61cbf74 100644 --- a/setup.py +++ b/setup.py @@ -78,14 +78,15 @@ def get_full_description(): 'Operating System :: OS Independent', 'Programming Language :: Python', 'Programming Language :: Python :: 3', - '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 :: Only', 'Framework :: Django', 'Framework :: Django :: 2.2', 'Framework :: Django :: 3.1', + 'Framework :: Django :: 4.0', 'Topic :: Internet :: WWW/HTTP', 'Topic :: Internet :: WWW/HTTP :: Dynamic Content', ], diff --git a/tests/test_project/urls.py b/tests/test_project/urls.py index f3c5556..e249e36 100644 --- a/tests/test_project/urls.py +++ b/tests/test_project/urls.py @@ -1,7 +1,7 @@ -from django.conf.urls import include, url +from django.urls import include, path from django.contrib import admin urlpatterns = [ - url(r'^admin/', admin.site.urls), - url(r'^advanced_filters/', include('advanced_filters.urls')) + path('admin/', admin.site.urls), + path('advanced_filters/', include('advanced_filters.urls')) ] diff --git a/tox.ini b/tox.ini index 82a1810..25371e0 100644 --- a/tox.ini +++ b/tox.ini @@ -1,21 +1,20 @@ [tox] envlist = - py{36,37,38,39,py3}-django{22,31} - ; py{36,37,38,39}-django{22,31,32} + py{37,py37}-django{22,32} + py{38,py38,39}-django{22,32,40} + py310-django{32,40} report - clean [pycodestyle] max-line-length = 120 [testenv] usedevelop = true -passenv = TRAVIS TRAVIS_* deps = -rtest-reqs.txt django22: Django>=2.2,<3.0 - django31: Django>=3.1,<3.2 - ; django32: Django>=3.2,<3.3 + django32: Django>=3.2,<3.3 + django40: Django>=4.0,<4.1 depends = !report: clean @@ -27,32 +26,20 @@ commands = pytest --cov-append . pycodestyle --exclude=urls.py,migrations,.ropeproject -v advanced_filters -[travis] -python = - 3.6: py36 - 3.7: py37 - 3.9: py39 - pypy3: pypy3 - -[travis:env] -DJANGO = - 2.2: django22 - 3.1: django31 - ; 3.2: django32 - [gh-actions] python = - 3.6: py36 3.7: py37 3.8: py38 3.9: py39 - pypy3: pypy3 + 3.10: py310 + pypy-3.7: pypy37 + pypy-3.8: pypy38 [gh-actions:env] DJANGO = 2.2: django22 - 3.1: django31 - ; 3.2: django32 + 3.2: django32 + 4.0: django40 [testenv:report] deps = coverage