Skip to main content

Dropdown population implementation for Django REST Framework

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

drf_dropdown-0.4.1.tar.gz (6.2 kB view hashes)

Uploaded Source

Built Distribution

drf_dropdown-0.4.1-py3-none-any.whl (7.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page