A django app to autofill admin 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 fields to be automatically filled with data from the last user-selected option of
the same field in a form produced by a shared formset.
This allows for an end-user to more efficiently input new data in instances where multiple field values may be shared across formset forms.
Install
-
Add
django_select2_autofillto your DjangoINSTALLED_APPSsetting:INSTALLED_APPS = [ # ... "django_select2_autofill", ]
-
Use the
AutofillAutocompleteSelectwidget in theModelFormcontainingautocomplete_fields:from django import admin from django import 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.models import CustomModel # ... 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 Distributions
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.1-py3-none-any.whl.
File metadata
- Download URL: django_select2_autofill-0.1.1-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 |
ab3c0901373db0b1cc77147d0c91863e3b132728526de0191247e0290ec0ae3a
|
|
| MD5 |
732577383f16749111a3810964324fca
|
|
| BLAKE2b-256 |
f27c7b28f5bd34bcde7022bcf396bb7c89e7bc878093a55dfb04e79d7f3dc07c
|