Skip to content

Commit

Permalink
Merge pull request #161 from modlinltd/support-py310-django40
Browse files Browse the repository at this point in the history
Support python 3.10 and django 4.0
  • Loading branch information
asfaltboy authored Jan 23, 2022
2 parents dfeb005 + cb165c8 commit 7bfb5b6
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 40 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ tests/db.sqlite*
/tests/local.db
/.venv
.vscode/settings.json
pyrightconfig.json
9 changes: 0 additions & 9 deletions advanced_filters/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 _
Expand Down Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions advanced_filters/urls.py
Original file line number Diff line number Diff line change
@@ -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<model>.+)/(?P<field_name>.+)/?',
path('field_choices/<model>/<field_name>/',
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'),
]
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
],
Expand Down
6 changes: 3 additions & 3 deletions tests/test_project/urls.py
Original file line number Diff line number Diff line change
@@ -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'))
]
33 changes: 10 additions & 23 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down

0 comments on commit 7bfb5b6

Please sign in to comment.