A django app to autofill Select2 fields in admin inline forms.
Project description
django_select2_autofill
django_select2_autofill is a Django app that allows newly added Django admin inline
form autocomplete fields to be automatically filled with data from the last
user-selected option of the same autocomplete field in a form produced by a shared
formset.
This allows end-users to more efficiently input new data in instances where one value
may be shared across ModelAdmin formset form autocomplete fields.
Install
-
With a Django project virtual environment activated:
python -m pip install django-select2-autofill
-
Add
django_select2_autofillto your DjangoINSTALLED_APPSsetting:INSTALLED_APPS = [ # ... "django_select2_autofill", ]
-
Use the
AutofillAutocompleteSelectwidget in theModelFormcontainingautocomplete_fields:from django import admin, forms from django_select2_autofill import AutofillAutocompleteSelect class CustomForm(forms.ModelForm): class Meta: widgets = { "model_field_name": AutofillAutocompleteSelect( CustomModel.model_field_name.field, admin.site ), }
Note that
admin.sitecan be replaced with a customAdminSiteinstance, if necessary:# ... from app.admin import CustomAdminSite # ... widgets = { "model_field_name": AutofillAutocompleteSelect( CustomModel.model_field_name.field, CustomAdminSite() ), }
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django_select2_autofill-0.1.4.tar.gz.
File metadata
- Download URL: django_select2_autofill-0.1.4.tar.gz
- Upload date:
- Size: 4.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
852a0842a5a7bc676d281273becf2d098d480a6595ac6c730ec48d9ce727da5e
|
|
| MD5 |
85102aceb5e11f307800b23232fd7e20
|
|
| BLAKE2b-256 |
f19b644123fe996569b3c359fa16f52cc01f6216aba29f0db0ae050b8c057c93
|
File details
Details for the file django_select2_autofill-0.1.4-py3-none-any.whl.
File metadata
- Download URL: django_select2_autofill-0.1.4-py3-none-any.whl
- Upload date:
- Size: 5.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c549e6f0661d7333bdb492b4362b041bd72bec4c57bc25516d4e92a95d1d7b04
|
|
| MD5 |
382e2e6736edbfb31953fbca79148065
|
|
| BLAKE2b-256 |
ce1d9247d8c23fb0c6efef348635411ad13c8871dd26628769b922c1d0866ae1
|