Dropdown population implementation for Django REST Framework
# urls.py
import dropdown
urlpatterns = [
...
path('dropdown/', dropdown.DropdownView.as_view(), name='dropdown'),
]
# someapp/dropdown.py
import dropdown
@dropdown.register
def users(query='', **kwargs):
return dropdown.from_model(User, label_field='email')
make setup