Multiple Select Widget with autocomplete
Project description
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for multiple_select_widget-0.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | b458d35efb3ad16cc3c114d2a9040890420e443f126aa05ab477a9a5d95fbfc9 |
|
MD5 | e015043d5bed83eb916ee338d7e31a79 |
|
BLAKE2b-256 | 59c7cf6e6dac07e362345cbfe6e338f1d0c6fe56f579f51ec292ddee61502c48 |
Close
Hashes for multiple_select_widget-0.1.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 86bbf62a680a466e808181cf23b5b7887d978d027987c4a11e410b03239606f2 |
|
MD5 | 7eef2fb23a5408d6f1986573b0e8d797 |
|
BLAKE2b-256 | 028fb2a84210660c5c4348ec43dc521541d7eab0fe7b3b3a4be90aac08f35aa0 |