Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/django.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ jobs:
strategy:
max-parallel: 4
matrix:
python-version: [3.9, "3.10", "3.11", "3.12"]
python-version: ["3.9", "3.10", "3.11", "3.12"]
dj-version: ["3.0.*", "3.1.*", "3.2.*", "4.0.*", "4.1.*", "4.2.*", "5.0.*", "5.1.*", "5.2.*"]
drf-version: ["3.11.*", "3.12.*", "3.13.*", "3.14.*", "3.15.*"]
drf-version: ["3.11.*", "3.12.*", "3.13.*", "3.14.*", "3.15.*", "3.16.*"]
exclude:
- dj-version: '4.0.*'
drf-version: '3.11.*'
Expand All @@ -36,8 +36,6 @@ jobs:
python-version: 3.9
- dj-version: '5.1.*'
python-version: 3.9
- dj-version: '5.2.*'
python-version: 3.9
- dj-version: '5.0.*'
drf-version: '3.11.*'
- dj-version: '5.0.*'
Expand All @@ -56,6 +54,8 @@ jobs:
drf-version: '3.12.*'
- dj-version: '5.2.*'
drf-version: '3.13.*'
- dj-version: '5.2.*'
drf-version: '3.16.*'
- python-version: 3.12
dj-version: '3.0.*'
- python-version: 3.12
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ over HTTP.

- Python (3.9, 3.10, 3.11, 3.12)
- Django (3.1, 3.2, 4.0, 4.1, 4.2, 5.0, 5.1)
- Django REST Framework (3.11, 3.12, 3.13, 3.14, 3.15)
- Django REST Framework (3.11, 3.12, 3.13, 3.14, 3.15, 3.16)

# Installation

Expand Down Expand Up @@ -649,7 +649,7 @@ We actively support the following:

- Python: 3.6, 3.7, 3.8, 3.9, 3.10, 3.11, 3.12
- Django: 2.2, 3.1, 3.2, 4.0, 4.1, 4.2, 5.0, 5.1
- Django Rest Framework: 3.11, 3.12, 3.13, 3.14, 3.15
- Django Rest Framework: 3.11, 3.12, 3.13, 3.14, 3.15, 3.16

**Note:** Some combinations are not supported. For up-to-date information on actively supported/tested combinations, see the `tox.ini` file.

Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,4 @@ Requirements

- Python (3.9, 3.10, 3.11, 3.12)
- Django (3.1, 3.2, 4.0, 4.1, 4.2, 5.0, 5.1)
- Django REST Framework (3.11, 3.12, 3.13, 3.14, 3.15)
- Django REST Framework (3.11, 3.12, 3.13, 3.14, 3.15, 3.16)
3 changes: 2 additions & 1 deletion dynamic_rest/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@
- Directory panel for the browsable API
- Optimizations
"""
__version__ = "2.5.1"

__version__ = "2.5.3"
default_app_config = "dynamic_rest.apps.DynamicRestConfig"
30 changes: 21 additions & 9 deletions dynamic_rest/filters/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ class DynamicFilterBackend(BaseFilterBackend):
This backend is responsible for interpreting and applying
filters, includes, and excludes to the base queryset of a view.
"""
DISABLE_PREFETCHING = False

def filter_queryset(self, request: Request, queryset: QuerySet, view) -> QuerySet:
"""Filter the queryset.
Expand All @@ -119,7 +120,7 @@ def filter_queryset(self, request: Request, queryset: QuerySet, view) -> QuerySe
# after this is called may not behave as expected
extra_filters = self.view.get_extra_filters(request)

disable_prefetches = self.view.is_update()
disable_prefetches = self.view.is_update() or self.DISABLE_PREFETCHING

return self._build_queryset(
queryset=queryset,
Expand Down Expand Up @@ -391,14 +392,14 @@ def _build_queryset(
if filters is None:
filters = _get_requested_filters(getattr(self, "view", None))

# build nested Prefetch queryset
self._build_requested_prefetches(
prefetches, requirements, model, fields, filters
)

# build remaining prefetches out of internal requirements
# that are not already covered by request requirements
self._build_implicit_prefetches(model, prefetches, requirements)
if not disable_prefetches:
# build nested Prefetch queryset
self._build_requested_prefetches(
prefetches, requirements, model, fields, filters
)
# build remaining prefetches out of internal requirements
# that are not already covered by request requirements
self._build_implicit_prefetches(model, prefetches, requirements)

# use requirements at this level to limit fields selected
# only do this for GET requests where we are not requesting the
Expand Down Expand Up @@ -461,3 +462,14 @@ def _build_queryset(
if DEBUG:
queryset._using_prefetches = prefetches # pylint: disable=protected-access
return queryset


class DynamicFilterNoPrefetchBackend(DynamicFilterBackend):
"""
A DRF filter backend that constructs DREST QuerySets without prefetching.

This backend is responsible for interpreting and applying
filters, includes, and excludes to the base queryset of a view.
"""

DISABLE_PREFETCHING = True
2 changes: 1 addition & 1 deletion install_requires.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Django>=3.2,<5.3
djangorestframework>=3.11.2,<3.16
djangorestframework>=3.11.2,<3.17
inflection>=0.5.0
requests
sqids>=0.1.0
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ tox==4.11.3
twine==4.0.2
inflection==0.5.1
Django>=3.2,<5.3
djangorestframework>=3.11.2,<3.16
djangorestframework>=3.11.2,<3.17
orjson>=3.9.7
black==23.9.1
isort==5.12.0
Expand Down
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
"""Setup script for dynamic-rest-bse."""

from setuptools import find_packages, setup

NAME = "dynamic-rest-bse"
DESCRIPTION = "Dynamic API support to Django REST Framework. Forked..."
URL = "http://github.com/BillSchumacher/dynamic-rest"
VERSION = "2.5.1"
VERSION = "2.5.3"
SCRIPTS = ["manage.py"]

with open("install_requires.txt", encoding="utf-8") as fp:
Expand Down