Metadata-Version: 2.1
Name: drf-dropdown
Version: 0.4.1
Summary: Dropdown population implementation for Django REST Framework
Home-page: https://github.com/earthpyy/drf-dropdown
License: MIT
Keywords: django,restframework,drf,dropdown
Author: Preeti Yuankrathok
Author-email: preetisatit@gmail.com
Requires-Python: >=3.8,<4.0
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Requires-Dist: django (>=3.1)
Requires-Dist: djangorestframework (>=3.11.0,<4.0.0)
Project-URL: Repository, https://github.com/earthpyy/drf-dropdown
Description-Content-Type: text/markdown

# drf-dropdown

![GitHub](https://img.shields.io/github/license/earthpyy/drf-dropdown)
![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/earthpyy/drf-dropdown/ci.yaml?branch=main)
![PyPI](https://img.shields.io/pypi/v/drf-dropdown)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/drf-dropdown)
![Pre-commit Enabled](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)

Dropdown population implementation for Django REST Framework

## Usage

### Add `DropdownView` to API URL

```python
# urls.py
import dropdown

urlpatterns = [
    ...
    path('dropdown/', dropdown.DropdownView.as_view(), name='dropdown'),
]
```

### Define new dropdown

```python
# someapp/dropdown.py
import dropdown

@dropdown.register
def users(query='', **kwargs):
    return dropdown.from_model(User, label_field='email')
```

## Development

### Set Up

```bash
make setup
```

