Skip to content

Commit 760845a

Browse files
n2ygksliverc
authored andcommitted
Deprecate MultipleIDMixin (#482)
1 parent 5d98c0b commit 760845a

File tree

3 files changed

+25
-1
lines changed

3 files changed

+25
-1
lines changed

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ any parts of the framework not mentioned in the documentation should generally b
1717
* Add related urls support. See [usage docs](docs/usage.md#related-urls)
1818
* Add optional [jsonapi-style](http://jsonapi.org/format/) filter backends. See [usage docs](docs/usage.md#filter-backends)
1919

20+
### Deprecated
21+
22+
* Deprecate `MultipleIDMixin` because it doesn't comply with the JSON:API 1.0 spec. Replace it with
23+
`DjangoFilterBackend` and **change clients** to use `filter[id.in]` query parameter instead of `ids[]`.
24+
See [usage docs](docs/usage.md#djangofilterbackend).
25+
2026
### Changed
2127

2228
* Replaced binary `drf_example` sqlite3 db with a [fixture](example/fixtures/drf_example.json). See [getting started](docs/getting-started.md#running-the-example-app).

README.rst

+3-1
Original file line numberDiff line numberDiff line change
@@ -184,4 +184,6 @@ override ``settings.REST_FRAMEWORK``
184184
'TEST_REQUEST_DEFAULT_FORMAT': 'vnd.api+json'
185185
}
186186

187-
This package provides much more including automatic inflection of JSON keys, extra top level data (using nested serializers), relationships, links, and handy shortcuts like MultipleIDMixin. Read more at http://django-rest-framework-json-api.readthedocs.org/
187+
This package provides much more including automatic inflection of JSON keys, extra top level data (using nested
188+
serializers), relationships, links, paginators, filters, and handy shortcuts.
189+
Read more at http://django-rest-framework-json-api.readthedocs.org/

rest_framework_json_api/mixins.py

+16
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,28 @@
11
"""
22
Class Mixins.
33
"""
4+
import warnings
45

56

67
class MultipleIDMixin(object):
78
"""
89
Override get_queryset for multiple id support
10+
11+
.. warning::
12+
13+
MultipleIDMixin is deprecated because it does not comply with http://jsonapi.org/format.
14+
Instead add :py:class:`django_filters.DjangoFilterBackend` to your
15+
list of `filter_backends` and change client usage from:
16+
``?ids[]=id1,id2,...,idN`` to ``'?filter[id.in]=id1,id2,...,idN``
17+
918
"""
19+
def __init__(self, *args, **kwargs):
20+
warnings.warn("MultipleIDMixin is deprecated. "
21+
"Instead add django_filters.DjangoFilterBackend to your "
22+
"list of 'filter_backends' and change client usage from: "
23+
"'?ids[]=id1,id2,...,idN' to '?filter[id.in]=id1,id2,...,idN'",
24+
DeprecationWarning)
25+
super(MultipleIDMixin, self).__init__(*args, **kwargs)
1026

1127
def get_queryset(self):
1228
"""

0 commit comments

Comments
 (0)