Skip to content

Added support for Django REST framework 3.15 #1209

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 18, 2024
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
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ any parts of the framework not mentioned in the documentation should generally b

* Added support for Python 3.12
* Added support for Django 5.0
* Added support for Django REST framework 3.15

### Fixed

Expand All @@ -26,10 +27,12 @@ any parts of the framework not mentioned in the documentation should generally b

* Removed support for Python 3.7.
* Removed support for Django 4.0.
* Removed support for Django REST framework 3.13.
* Removed obsolete compat `NullBooleanField` and `get_reference` definitions.

## [6.1.0] - 2023-08-25

This is the last release supporting Python 3.7 and Django 4.0.
This is the last release supporting Python 3.7, Django 4.0 and Django REST framework 3.13.

### Added

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

1. Python (3.8, 3.9, 3.10, 3.11, 3.12)
2. Django (3.2, 4.1, 4.2, 5.0)
3. Django REST framework (3.13, 3.14)
3. Django REST framework (3.14, 3.15)

We **highly** recommend and only officially support the latest patch release of each Python, Django and REST framework series.

Expand Down
2 changes: 1 addition & 1 deletion docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ like the following:

1. Python (3.8, 3.9, 3.10, 3.11, 3.12)
2. Django (3.2, 4.1, 4.2, 5.0)
3. Django REST framework (3.13, 3.14)
3. Django REST framework (3.14, 3.15)

We **highly** recommend and only officially support the latest patch release of each Python, Django and REST framework series.

Expand Down
15 changes: 0 additions & 15 deletions rest_framework_json_api/compat.py
Original file line number Diff line number Diff line change
@@ -1,15 +0,0 @@
# Django REST framework 3.14 removed NullBooleanField
# can be removed once support for DRF 3.13 is dropped.
try:
from rest_framework.serializers import NullBooleanField
except ImportError: # pragma: no cover
NullBooleanField = object()


# Django REST framework 3.14 deprecates usage of `_get_reference`.
# can be removed once support for DRF 3.13 is dropped.
def get_reference(schema, serializer):
try:
return schema.get_reference(serializer)
except AttributeError: # pragma: no cover
return schema._get_reference(serializer)
2 changes: 0 additions & 2 deletions rest_framework_json_api/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from rest_framework.settings import api_settings
from rest_framework.utils.field_mapping import ClassLookupDict

from rest_framework_json_api.compat import NullBooleanField
from rest_framework_json_api.utils import format_field_name, get_related_resource_type


Expand All @@ -22,7 +21,6 @@ class JSONAPIMetadata(SimpleMetadata):
serializers.Field: "GenericField",
serializers.RelatedField: "Relationship",
serializers.BooleanField: "Boolean",
NullBooleanField: "Boolean",
serializers.CharField: "String",
serializers.URLField: "URL",
serializers.EmailField: "Email",
Expand Down
7 changes: 2 additions & 5 deletions rest_framework_json_api/schemas/openapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from rest_framework.schemas.utils import is_list_view

from rest_framework_json_api import serializers, views
from rest_framework_json_api.compat import get_reference
from rest_framework_json_api.relations import ManySerializerMethodResourceRelatedField
from rest_framework_json_api.utils import format_field_name

Expand Down Expand Up @@ -533,12 +532,10 @@ def _get_toplevel_200_response(self, operation, path, method, collection=True):
if collection:
data = {
"type": "array",
"items": get_reference(
self, self.get_response_serializer(path, method)
),
"items": self.get_reference(self.get_response_serializer(path, method)),
}
else:
data = get_reference(self, self.get_response_serializer(path, method))
data = self.get_reference(self.get_response_serializer(path, method))

return {
"description": operation["operationId"],
Expand Down
2 changes: 0 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,6 @@ DJANGO_SETTINGS_MODULE=example.settings.test
filterwarnings =
error::DeprecationWarning
error::PendingDeprecationWarning
# Remove when DRF is not depending on it anymore
ignore:The django.utils.timezone.utc alias is deprecated.
# Django filter schema generation. Can be removed once we remove
# schema support
ignore:Built-in schema generation is deprecated.
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def get_package_data(package):
},
install_requires=[
"inflection>=0.5.0",
"djangorestframework>=3.13",
"djangorestframework>=3.14",
"django>=3.2",
],
extras_require={
Expand Down
10 changes: 5 additions & 5 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[tox]
envlist =
py{38,39,310}-django32-drf{313,314,master},
py{38,39,310,311}-django41-drf{314,master},
py{38,39,310,311,312}-django42-drf{314,master},
py{310,311,312}-django50-drf{314,master},
py{38,39,310}-django32-drf{314,315,master},
py{38,39,310,311}-django41-drf{314,315,master},
py{38,39,310,311,312}-django42-drf{314,315,master},
py{310,311,312}-django50-drf{314,315,master},
black,
docs,
lint
Expand All @@ -14,8 +14,8 @@ deps =
django41: Django>=4.1,<4.2
django42: Django>=4.2,<4.3
django50: Django>=5.0,<5.1
drf313: djangorestframework>=3.13,<3.14
drf314: djangorestframework>=3.14,<3.15
drf315: djangorestframework>=3.15,<3.16
drfmaster: https://github.com/encode/django-rest-framework/archive/master.zip
-rrequirements/requirements-testing.txt
-rrequirements/requirements-optionals.txt
Expand Down
Loading