Skip to content

Dropdown population implementation for Django REST Framework

License

Notifications You must be signed in to change notification settings

earthpyy/drf-dropdown

Repository files navigation

drf-dropdown

GitHub GitHub Workflow Status PyPI PyPI - Python Version Pre-commit Enabled

Dropdown population implementation for Django REST Framework

Usage

Add DropdownView to API URL

# urls.py
import dropdown

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

Define new dropdown

# someapp/dropdown.py
import dropdown

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

Development

Set Up

make setup

About

Dropdown population implementation for Django REST Framework

Resources

License

Stars

Watchers

Forks

Sponsor this project

Packages

No packages published