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
File details
Details for the file multiple_select_widget-0.1.0.tar.gz
.
File metadata
- Download URL: multiple_select_widget-0.1.0.tar.gz
- Upload date:
- Size: 14.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b458d35efb3ad16cc3c114d2a9040890420e443f126aa05ab477a9a5d95fbfc9 |
|
MD5 | e015043d5bed83eb916ee338d7e31a79 |
|
BLAKE2b-256 | 59c7cf6e6dac07e362345cbfe6e338f1d0c6fe56f579f51ec292ddee61502c48 |
File details
Details for the file multiple_select_widget-0.1.0-py2.py3-none-any.whl
.
File metadata
- Download URL: multiple_select_widget-0.1.0-py2.py3-none-any.whl
- Upload date:
- Size: 14.5 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 86bbf62a680a466e808181cf23b5b7887d978d027987c4a11e410b03239606f2 |
|
MD5 | 7eef2fb23a5408d6f1986573b0e8d797 |
|
BLAKE2b-256 | 028fb2a84210660c5c4348ec43dc521541d7eab0fe7b3b3a4be90aac08f35aa0 |