Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/wimglenn/djangorestframework-queryfields
Allows clients to control which fields will be sent in the API response
https://github.com/wimglenn/djangorestframework-queryfields
django django-rest-framework libraries python python-2 python-3 rest-api
Last synced: 3 days ago
JSON representation
Allows clients to control which fields will be sent in the API response
- Host: GitHub
- URL: https://github.com/wimglenn/djangorestframework-queryfields
- Owner: wimglenn
- License: mit
- Created: 2016-10-19T19:20:01.000Z (about 8 years ago)
- Default Branch: main
- Last Pushed: 2024-11-05T02:08:25.000Z (2 months ago)
- Last Synced: 2025-01-03T09:06:14.905Z (10 days ago)
- Topics: django, django-rest-framework, libraries, python, python-2, python-3, rest-api
- Language: Python
- Homepage: http://djangorestframework-queryfields.readthedocs.io/
- Size: 44.9 KB
- Stars: 216
- Watchers: 8
- Forks: 16
- Open Issues: 7
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
Awesome Lists containing this project
- awesome-django-performance - djangorestframework-queryfields - Allows clients to control which fields will be sent in the API response. (Database / Tools)
README
Django REST framework QueryFields
=================================|gh| |codecov| |pypi| |womm|
.. |gh| image:: https://github.com/wimglenn/djangorestframework-queryfields/actions/workflows/main.yml/badge.svg
.. _gh: https://github.com/wimglenn/djangorestframework-queryfields/actions.. |codecov| image:: https://codecov.io/gh/wimglenn/djangorestframework-queryfields/branch/main/graph/badge.svg?token=WeqbZ83YRg
.. _codecov: https://codecov.io/gh/wimglenn/djangorestframework-queryfields.. |pypi| image:: https://img.shields.io/pypi/v/djangorestframework-queryfields.svg
.. _pypi: https://pypi.org/project/djangorestframework-queryfields.. |womm| image:: https://cdn.rawgit.com/nikku/works-on-my-machine/v0.2.0/badge.svg
.. _womm: https://github.com/nikku/works-on-my-machineAllows clients to control which fields will be sent in the API response. Fields are specified in the query, e.g.
.. code-block::
# You want a list of users but you're only interested in the fields "id" and "username":
GET /users/?fields=id,username
[
{
"id": 1,
"username": "tom"
},
{
"id": 2,
"username": "wim"
}
]
# You want to see every field except "id" for the specific user wim:
GET /users/2/?fields!=id
{
"username": "wim",
"email": "[email protected]",
"spirit_animal": "raccoon"
}**Supported Django versions**: 1.7 - 3.2+. Check the `CI matrix `_ for details.
Documentation is hosted on `Read The Docs `_.
Developers, developers, developers!
-----------------------------------Want to contribute to the project? This is how to run the test suite:
.. code-block:: bash
# get the codez
git clone https://github.com/wimglenn/djangorestframework-queryfields.git# create and/or activate your virtualenv, this or something like it:
cd djangorestframework-queryfields
python3 -m venv .venv
source .venv/bin/activate# installing the app in your venv
pip install --editable ".[dev]"
git checkout -b myfeature# hack away, then ...
pytest