Skip to main content

Multiple Select Widget with autocomplete

Project description

https://badge.fury.io/py/multiple_select_widget.svg https://travis-ci.org/JPolonia/multiple_select_widget.svg?branch=master https://codecov.io/gh/JPolonia/multiple_select_widget/branch/master/graph/badge.svg

Multiple Select Widget with autocomplete

Documentation

The full documentation is at https://multiple_select_widget.readthedocs.io.

Quickstart

Install Multiple Select Widget:

pip install multiple_select_widget

Add it to your INSTALLED_APPS:

INSTALLED_APPS = (
    ...
    'multiple_select_widget.apps.MultipleSelectWidgetConfig',
    ...
)

Add Multiple Select Widget’s to your forms:

class GroupChangeForm(forms.ModelForm):

    users = MSWModelMultipleChoiceField(
        queryset=User.objects.all(),
        required=False,
        widget=MultipleSelectWidget('Users', reverse_lazy('user_filter'), lazy=True, use_async=True),
    )

For Django Admin user register using the form

@admin.register(Group)
class GroupAdmin(admin.ModelAdmin):
    form = GroupChangeForm

Add the autocomplete view MultipleSelectWidgetView to urls.py

### views.py
class UsersAutocompleteMSWView(MultipleSelectWidgetView):
    model = User
    fields = ('email__icontains',)
    obj_limit = 100

### urls.py
path('user/autocomplete-msw/', UsersAutocompleteMSWView.as_view(), name='user_autocomplete_msw'),

Features

  • TODO

Running Tests

Does the code actually work?

source <YOURVIRTUALENV>/bin/activate
(myenv) $ pip install tox
(myenv) $ tox

Development commands

pip install -r requirements_dev.txt
invoke -l

Credits

Tools used in rendering this package:

History

0.1.0 (2021-04-29)

  • First release on PyPI.

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

multiple_select_widget-0.1.0.tar.gz (14.3 kB view hashes)

Uploaded Source

Built Distribution

multiple_select_widget-0.1.0-py2.py3-none-any.whl (14.5 kB view hashes)

Uploaded Python 2 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