Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Deprecated support for django-polymorphic resources #1303

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
n2ygk merged 1 commit into django-json-api:main from sliverc:deprecate_polymorphic
Sep 24, 2025
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
Deprecated support for django-polymorphic resources
Desired for Django Polymorphic support to be added in an external
3rd party library in case there is a demand and someone is to be
found who will take the lead.
  • Loading branch information
sliverc committed Sep 23, 2025
commit ee31c1fa4a7ff8ed9bfc61f1aec0bc5bfd368847
4 changes: 4 additions & 0 deletions CHANGELOG.md
View file Open in desktop
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
View file Open in desktop
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
View file Open in desktop
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
View file Open in desktop
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

AltStyle によって変換されたページ (->オリジナル) /