From b54bc78606e5be1a87207ec4de38dbb549874e13 Mon Sep 17 00:00:00 2001 From: vb64 Date: Fri, 15 Dec 2023 11:22:23 +0400 Subject: [PATCH 1/3] Django5 support --- .github/workflows/django4.yml | 2 +- .github/workflows/django5.yml | 49 +++++++++++++++++++++++++++++++++++ README.md | 4 +-- pytest5.ini | 3 +++ tests/django3.txt | 2 +- tests/django4.txt | 2 +- tests/django5.txt | 1 + 7 files changed, 58 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/django5.yml create mode 100644 pytest5.ini create mode 100644 tests/django5.txt diff --git a/.github/workflows/django4.yml b/.github/workflows/django4.yml index 5f5f92c..5fb2e93 100644 --- a/.github/workflows/django4.yml +++ b/.github/workflows/django4.yml @@ -15,7 +15,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ['3.8', '3.9', '3.10', '3.11'] + python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] steps: - uses: actions/checkout@v3 diff --git a/.github/workflows/django5.yml b/.github/workflows/django5.yml new file mode 100644 index 0000000..f557483 --- /dev/null +++ b/.github/workflows/django5.yml @@ -0,0 +1,49 @@ +# https://docs.github.com/en/free-pro-team@latest/actions/guides/building-and-testing-python +name: django5 + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + + django5: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ['3.10', '3.11', '3.12'] + + steps: + - uses: actions/checkout@v3 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v3 + with: + python-version: ${{ matrix.python-version }} + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r tests/requirements.txt + pip install -r tests/django5.txt + + - name: flake8 + run: | + flake8 --count --show-source --statistics --max-line-length=120 django_admin_filters + flake8 --count --show-source --statistics --max-line-length=120 tests/test + + - name: pylint + run: | + python -m pylint django_admin_filters + python -m pylint tests/test + + - name: pytest + run: | + python manage.py collectstatic --noinput --settings example.settings + python manage.py makemigrations --settings example.settings example + python manage.py migrate --settings example.settings + pytest -c pytest5.ini --cov=django_admin_filters --cov-report xml --cov-report term:skip-covered --durations=5 tests diff --git a/README.md b/README.md index 46f3da5..2f04b86 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # DjangoAdminFilters library [![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/vb64/django.admin.filters/pep257.yml?label=Pep257&style=plastic&branch=main)](https://github.com/vb64/django.admin.filters/actions?query=workflow%3Apep257) -[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/vb64/django.admin.filters/django3.yml?label=Django%203.2.20%20Python%203.7-3.10&style=plastic&branch=main)](https://github.com/vb64/django.admin.filters/actions?query=workflow%3Adjango3) -[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/vb64/django.admin.filters/django4.yml?label=Django%204.2.3%20Python%203.8-3.11&style=plastic&branch=main)](https://github.com/vb64/django.admin.filters/actions?query=workflow%3Adjango4) +[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/vb64/django.admin.filters/django3.yml?label=Django%203.2.23%20Python%203.7-3.10&style=plastic&branch=main)](https://github.com/vb64/django.admin.filters/actions?query=workflow%3Adjango3) +[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/vb64/django.admin.filters/django4.yml?label=Django%204.2.8%20Python%203.8-3.11&style=plastic&branch=main)](https://github.com/vb64/django.admin.filters/actions?query=workflow%3Adjango4) [![Codacy Badge](https://app.codacy.com/project/badge/Grade/926ec3c1141f4230b4d0508497e5561f)](https://app.codacy.com/gh/vb64/django.admin.filters/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade) [![Codacy Badge](https://app.codacy.com/project/badge/Coverage/926ec3c1141f4230b4d0508497e5561f)](https://app.codacy.com/gh/vb64/django.admin.filters/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_coverage) [![PyPI - Downloads](https://img.shields.io/pypi/dm/django-admin-list-filters?label=pypi%20installs)](https://pypistats.org/packages/django-admin-list-filters) diff --git a/pytest5.ini b/pytest5.ini new file mode 100644 index 0000000..cc33aae --- /dev/null +++ b/pytest5.ini @@ -0,0 +1,3 @@ +[pytest] +filterwarnings = + ignore::django.utils.deprecation.RemovedInDjango51Warning diff --git a/tests/django3.txt b/tests/django3.txt index 2d0739f..db84d23 100644 --- a/tests/django3.txt +++ b/tests/django3.txt @@ -1 +1 @@ -Django==3.2.20 +Django==3.2.23 diff --git a/tests/django4.txt b/tests/django4.txt index b1ba9b3..07755e1 100644 --- a/tests/django4.txt +++ b/tests/django4.txt @@ -1 +1 @@ -Django==4.2.3 +Django==4.2.8 diff --git a/tests/django5.txt b/tests/django5.txt new file mode 100644 index 0000000..90208ee --- /dev/null +++ b/tests/django5.txt @@ -0,0 +1 @@ +Django==5.0 From 4952fe1b654cc59231517f6a276c11b2438b8800 Mon Sep 17 00:00:00 2001 From: "vb.zond-office" Date: Mon, 19 Feb 2024 16:51:40 +0400 Subject: [PATCH 2/3] step --- makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/makefile b/makefile index 9aa05c7..3f1f1d5 100644 --- a/makefile +++ b/makefile @@ -10,7 +10,7 @@ PTEST = ./venv/bin/pytest COVERAGE = ./venv/bin/coverage endif -DJANGO_VER = 4 +DJANGO_VER = 5 SOURCE = django_admin_filters TESTS = tests From 96229f9be009af6fa5503db8578b65e5e8626096 Mon Sep 17 00:00:00 2001 From: "vb.zond-office" Date: Mon, 19 Feb 2024 18:39:07 +0400 Subject: [PATCH 3/3] step --- django_admin_filters/base.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/django_admin_filters/base.py b/django_admin_filters/base.py index 4ea98ef..f93cee5 100644 --- a/django_admin_filters/base.py +++ b/django_admin_filters/base.py @@ -31,6 +31,13 @@ def __init__(self, field, request, params, model, model_admin, field_path): super().__init__(field, request, params, model, model_admin, field_path) self.set_title() + def get_facet_counts(self, _pk_attname, _filtered_qs): + """Django5 amin site Facets. + + https://docs.djangoproject.com/en/5.0/ref/contrib/admin/filters/#facet-filters + """ + return {} + def value(self): """Return the string provided in the request's query string.