Skip to content

Commit

Permalink
Merge branch 'main' into patch-2
Browse files Browse the repository at this point in the history
  • Loading branch information
bryan-brancotte authored Jan 26, 2024
2 parents 0e4ccdd + fd662c8 commit 6ac9301
Show file tree
Hide file tree
Showing 97 changed files with 6,199 additions and 3,919 deletions.
3 changes: 1 addition & 2 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
---
name: Bug report
about: Updating to 2.0? Did you read the migration guide? https://django-filter.readthedocs.io/en/master/guide/migration.html#migration-guide

about: Found an issue, here's the place. Got a question? Use Discussions instead.
---


17 changes: 11 additions & 6 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
---
name: Tests
on: [push, pull_request]

on:
push:
branches:
- main
pull_request:

jobs:
tests:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: [3.5, 3.6, 3.7, 3.8, 3.9.0-rc - 3.9]
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v2
Expand All @@ -21,12 +26,12 @@ jobs:
python -m pip install --upgrade pip setuptools
- name: Install dependencies
run: |
python -m pip install coverage tox tox-factor unittest-xml-reporting
python -m pip install coverage tox tox-py unittest-xml-reporting
- name: Run tox
run: |
python -m pip --version
python -m tox --version
python -m tox -f py$(python --version 2>&1 | cut -c 8,10)
python -m tox --py current
- name: Coverage reporting
run: |
coverage combine
Expand All @@ -44,7 +49,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8
python-version: "3.10"
- name: Ensure latest setuptools
run: |
python -m pip install --upgrade pip setuptools
Expand All @@ -65,7 +70,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8
python-version: "3.10"
- name: Ensure latest setuptools
run: |
python -m pip install --upgrade pip setuptools
Expand Down
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,7 @@ docs/_build
.coverage
.coverage.*
.xmlcoverage/
.venv/
.venv/
.idea
.env
.vscode
17 changes: 17 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# https://docs.readthedocs.io/en/stable/config-file/v2.html

version: 2

# Build documentation in the docs/ directory with Sphinx
sphinx:
configuration: docs/conf.py

# Set the version of Python and other tools you might need
build:
os: ubuntu-22.04
tools:
python: "3.10"

python:
install:
- requirements: requirements/docs.txt
105 changes: 104 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,104 @@
Version 23.5 (2023-12-05)
-------------------------

* Fixed OrderingFilter handling of empty values. (#1628)

Thanks to Matt Munns.

Version 23.4 (2023-11-20)
-------------------------

* Official support for Django 5.0 and Python 3.12.

* Fix DeprecationWarning for pkgutil.find_loader.

Thanks to `wmorrell`.

* Adopted Furo theme for docs.

Version 23.3 (2023-9-17)
------------------------

* Adds initial compatibility with Django 5.0, prior to Django 5.0a1.

* Updates packaging to use pyproject.toml and Flit.

Version 23.2 (2023-4-30)
------------------------

* Deprecated the schema generation methods of the DRF related ``DjangoFilterBackend``.
These will be removed in version 25.1.

You should use `drf-spectacular <https://drf-spectacular.readthedocs.io/en/latest/>`_
for generating OpenAPI schemas with DRF.

* In addition, stopped testing against the (very old now) ``coreapi`` schema generation.
These methods should continue to work if you're using them until v25.1, but
``coreapi`` is no longer maintained, and is raising warnings against the current
versions of Python. To workaround this is not worth the effort at this point.

* Updated Polish translations.

Version 23.1 (2023-3-26)
------------------------

* Declared support for Django 4.2.

* Various updated and new translations. Thanks to all who contributed, and
Weblate for hosting.

* Fixed QueryArrayWidget.value_from_datadict() to not mutate input data. (#1540)

Version 22.1 (2022-6-17)
------------------------

* Update supported Python and Django versions: minimal Python is now 3.7,
minimum Django is now 3.2.

* Added testing for Python 3.10 and Django 4.1.

* Removed outdated deprecated warnings for code removed in version 2.1.

* Removed `filter_class` (use `filterset_class`) and `filter_fields`
(`filterset_fields`) that were deprecated in [version 2.0
(2018)](https://django-filter.readthedocs.io/en/main/guide/migration.html#view-attributes-renamed-867).

* The code base is now formatted with Black.

Version 21.1 (2021-9-24)
------------------------

This is a maintenance release updating CI testing for the latest
non-end-of-life versions of Python and Django, and updating package metadata
accordingly.

With this release ``django-filter`` is switching to a two-part CalVer
versioning scheme, such as ``21.1``. The first number is the year. The second
is the release number within that year.

On an on-going basis, Django-Filter aims to support all current Django
versions, the matching current Python versions, and the latest version of
Django REST Framework.

Please see:

* `Status of supported Python branches <https://devguide.python.org/#status-of-python-branches>`_
* `List of supported Django versions <https://www.djangoproject.com/download/#support-versions>`_

Support for Python and Django versions will be dropped when they reach
end-of-life. Support for Python versions will dropped when they reach
end-of-life, even when still supported by a current version of Django.

Other breaking changes are rare. Where required, every effort will be made to
apply a "Year plus two" deprecation period. For example, a change initially
introduced in ``23.x`` would offer a fallback where feasible and finally be
removed in ``25.1``. Where fallbacks are not feasible, breaking changes without
deprecation will be called out in the release notes.

Beyond that change, there are few changes. Some small bugfixes, improvements to
localisation, and documentation tweaks. Thanks to all who were involved.


Version 2.4.0 (2020-9-27)
--------------------------

Expand All @@ -15,6 +116,7 @@ Version 2.4.0 (2020-9-27)
In addition tests against Django main development branch are now required to
pass.


Version 2.3.0 (2020-6-5)
------------------------

Expand All @@ -27,6 +129,7 @@ Version 2.3.0 (2020-6-5)
* Fixed IsoDateTimeRangeFieldTests for Django 3.1
* Require tests to pass against Django `master`.


Version 2.2 (2019-7-16)
-----------------------

Expand Down Expand Up @@ -56,7 +159,7 @@ Version 2.0 (2018-7-13)
2.0 introduced a number of small changes and tidy-ups.
Please see the migration guide:

https://django-filter.readthedocs.io/en/master/guide/migration.html#migrating-to-2-0
https://django-filter.readthedocs.io/en/main/guide/migration.html#migrating-to-2-0

* Added testing for Python 3.7 (#944)
* Improve exception message for invalid filter result (#943)
Expand Down
41 changes: 29 additions & 12 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,32 @@ Full documentation on `read the docs`_.
.. image:: https://badge.fury.io/py/django-filter.svg
:target: http://badge.fury.io/py/django-filter

Requirements
------------

* **Python**: 3.5, 3.6, 3.7, 3.8, 3.9
* **Django**: 2.2, 3.0, 3.1
* **DRF**: 3.10+
Versioning and stability policy
-------------------------------

Django-Filter is a mature and stable package. It uses a two-part CalVer
versioning scheme, such as ``21.1``. The first number is the year. The second
is the release number within that year.

On an on-going basis, Django-Filter aims to support all current Django
versions, the matching current Python versions, and the latest version of
Django REST Framework.

Please see:

* `Status of supported Python versions <https://devguide.python.org/versions/#supported-versions>`_
* `List of supported Django versions <https://www.djangoproject.com/download/#supported-versions>`_

Support for Python and Django versions will be dropped when they reach
end-of-life. Support for Python versions will be dropped when they reach
end-of-life, even when still supported by a current version of Django.

From Version 2.0 Django Filter is Python 3 only.
If you need to support Python 2.7 use the version 1.1 release.
Other breaking changes are rare. Where required, every effort will be made to
apply a "Year plus two" deprecation period. For example, a change initially
introduced in ``23.x`` would offer a fallback where feasible and finally be
removed in ``25.1``. Where fallbacks are not feasible, breaking changes without
deprecation will be called out in the release notes.


Installation
Expand Down Expand Up @@ -94,9 +111,9 @@ For more details see the `DRF integration docs`_.
Support
-------

If you have questions about usage or development you can join the
`mailing list`_.
If you need help you can start a `discussion`_. For commercial support, please
`contact Carlton Gibson via his website <https://noumenal.es/>`_.

.. _`read the docs`: https://django-filter.readthedocs.io/en/master/
.. _`mailing list`: http://groups.google.com/group/django-filter
.. _`DRF integration docs`: https://django-filter.readthedocs.io/en/master/guide/rest_framework.html
.. _`discussion`: https://github.com/carltongibson/django-filter/discussions
.. _`read the docs`: https://django-filter.readthedocs.io/en/main/
.. _`DRF integration docs`: https://django-filter.readthedocs.io/en/stable/guide/rest_framework.html
23 changes: 16 additions & 7 deletions django_filters/__init__.py
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
# flake8: noqa
import pkgutil
from importlib import util as importlib_util

from .filters import *
from .filterset import FilterSet

# We make the `rest_framework` module available without an additional import.
# If DRF is not installed, no-op.
if pkgutil.find_loader('rest_framework') is not None:
if importlib_util.find_spec("rest_framework"):
from . import rest_framework
del pkgutil
del importlib_util

__version__ = '2.4.0'
__version__ = "23.5"


def parse_version(version):
'''
"""
'0.1.2.dev1' -> (0, 1, 2, 'dev1')
'0.1.2' -> (0, 1, 2)
'''
v = version.split('.')
"""
v = version.split(".")
ret = []
for p in v:
if p.isdigit():
Expand All @@ -27,4 +27,13 @@ def parse_version(version):
ret.append(p)
return tuple(ret)


VERSION = parse_version(__version__)



assert VERSION < (25,0), "Remove deprecated code"


class RemovedInDjangoFilter25Warning(DeprecationWarning):
pass
9 changes: 8 additions & 1 deletion django_filters/compat.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
import django
from django.conf import settings
from django.test import TestCase

if django.VERSION < (4, 2):
class TestCase(TestCase):
assertQuerySetEqual = TestCase.assertQuerysetEqual


# django-crispy-forms is optional
try:
Expand All @@ -8,7 +15,7 @@


def is_crispy():
return 'crispy_forms' in settings.INSTALLED_APPS and crispy_forms
return "crispy_forms" in settings.INSTALLED_APPS and crispy_forms


# coreapi is optional (Note that uritemplate is a dependency of coreapi)
Expand Down
Loading

0 comments on commit 6ac9301

Please sign in to comment.