Restrict fields returned by DRF serializers
Project description
Features
Restrict fields returned by DRF serializers using the only query parameter
GET http://127.0.0.1:8000/api/users/?only=id&only=name
Serialize only the id and name fields.
{
"count": 198,
"next": "http://127.0.0.1:8000/api/users/?only=id&only=name&page=1",
"previous": null,
"results":[
{
"id": 1,
"name": "Test"
},
...
],
}
Defer fields returned by DRF serializers using the defer query parameter
GET http://127.0.0.1:8000/api/users/?defer=name&defer=age
Serialize only the id and name fields.
{
"count": 198,
"next": "http://127.0.0.1:8000/api/users/?defer=name&defer=age&page=1",
"previous": null,
"results":[
{
"id": 1,
},
...
],
}
Free software: MIT license
Documentation: https://drf-restricted-fields.readthedocs.io.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file drf_restricted_fields-0.0.1.tar.gz
.
File metadata
- Download URL: drf_restricted_fields-0.0.1.tar.gz
- Upload date:
- Size: 6.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.15.0 pkginfo/1.7.0 requests/2.24.0 setuptools/44.1.1 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/2.7.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c1539e85a47de6f0c4bac3fbefd531be66a2166710a022123b6ff0ac3895d095 |
|
MD5 | e3dccb7fb9318552443e0934acba0bd7 |
|
BLAKE2b-256 | 5fc2a748c4456276fdba233ac526116a0a040e86c0a6daeb430205aa14a79b88 |
File details
Details for the file drf_restricted_fields-0.0.1-py2.py3-none-any.whl
.
File metadata
- Download URL: drf_restricted_fields-0.0.1-py2.py3-none-any.whl
- Upload date:
- Size: 4.9 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.15.0 pkginfo/1.7.0 requests/2.24.0 setuptools/44.1.1 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/2.7.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2dd9d0ad89044fa45c1132432fc98fcee7b9249fb321f4d5947bfdc41b3e0a94 |
|
MD5 | ddaeb9b0fd240fed1b32ee0339213a62 |
|
BLAKE2b-256 | f7fffcdba065be7d637629eaeaa4c0455cd67fd1f89f2dc0b1c5111da230b2bf |