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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ any parts of the framework not mentioned in the documentation should generally b

* Ensured that an empty `included` array is returned in responses when the `include` query parameter is present but no related resources exist.

### Deprecated

* Deprecated support for using Polymorphic resources through [django-polymorphic](https://github.com/jazzband/django-polymorphic). There is currently no replacement. In case you are affected of this change please join [our discussion](https://github.com/django-json-api/django-rest-framework-json-api/discussions/1194).

## [8.0.0] - 2025-07-24

### Added
Expand Down
11 changes: 11 additions & 0 deletions docs/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -863,6 +863,17 @@ field_name_mapping = {

### Working with polymorphic resources

--

**Deprecation notice:**


Support for using Polymorphic resources through [django-polymorphic](https://github.com/jazzband/django-polymorphic) is deprecated and will be removed in a future release.

There is currently no replacement. In case you are affected of this change please join [our discussion](https://github.com/django-json-api/django-rest-framework-json-api/discussions/1194).

---

Polymorphic resources allow you to use specialized subclasses without requiring
special endpoints to expose the specialized versions. For example, if you had a
`Project` that could be either an `ArtProject` or a `ResearchProject`, you can
Expand Down
11 changes: 11 additions & 0 deletions rest_framework_json_api/serializers.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import warnings
from collections.abc import Mapping

from django.core.exceptions import ObjectDoesNotExist
Expand Down Expand Up @@ -342,6 +343,16 @@ def __new__(cls, name, bases, attrs):
if not parents:
return new_class

warnings.warn(
DeprecationWarning(
"Support for polymorphic resources is deprecated."
"There is currently no replacement. In case you are affected of this "
"change please join discussion at "
"https://github.com/django-json-api/django-rest-framework-json-api/discussions/1194."
),
stacklevel=2,
)

polymorphic_serializers = getattr(new_class, "polymorphic_serializers", None)
assert (
polymorphic_serializers is not None
Expand Down
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ DJANGO_SETTINGS_MODULE=example.settings.test
filterwarnings =
error::DeprecationWarning
error::PendingDeprecationWarning
ignore:Support for polymorphic resources is deprecated
testpaths =
example
tests