django-admin-form-action 
django-admin-form-action is intended to implement parametrized actions on the Django admin site.
Action parameters are passed through an intermediate form as it shown below.
The demonstrated functionality can be implemented with django-admin-form-action in the following way:
from django import forms
from django.contrib import admin
from django.contrib.auth.models import Group, User
from admin_form_action import form_action
class GroupsForm(forms.Form):
groups = forms.ModelMultipleChoiceField(queryset=Group.objects.all())
def add_user(self, user: User):
user.groups.add(*self.cleaned_data['groups'])
@admin.register(User)
class UserAdmin(admin.ModelAdmin):
actions = ['add_to_groups']
@form_action(GroupsForm)
@admin.action(description='Add selected users to certain groups')
def add_to_groups(self, request, queryset):
# Validated form is injected by `@form_action` to `request.form`
groups_form = request.form
for user in queryset:
groups_form.add_user(user)
Install
pip install django-admin-form-action
INSTALLED_APPS = [
...
'admin_form_action',
...
]
Development
Run demo app
poetry install
poetry run django-admin migrate --settings=tests.app.settings
poetry run django-admin runserver --settings=tests.app.settings
Test
poetry run pytest
Lint
poetry run isort .
poetry run ruff .
poetry run mypy .
Metadata
Release files for django-admin-form-action 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| django_admin_form_action-1.0.0.tar.gz | 4.4 kB | Without provenance | Details for django_admin_form_action-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| django_admin_form_action-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for django_admin_form_action-1.0.0-py3-none-any.whl |
Total release size: 9.5 kB
Release files / django_admin_form_action-1.0.0.tar.gz
| Download URL | django_admin_form_action-1.0.0.tar.gz |
|---|---|
| Size | 4.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3849d9976daf47aa60f02c5eb273932bfbcdaa1bcfd024a9ecb0b383ad643e3e
|
|
BLAKE2b-256 checksum How to use checksums |
9317052f899c7270e4340c5bc550f611aadec4f92e20febf695f5b16237a0354
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.6.1 CPython/3.11.5 Darwin/21.6.0
|
Release files / django_admin_form_action-1.0.0-py3-none-any.whl
| Download URL | django_admin_form_action-1.0.0-py3-none-any.whl |
|---|---|
| Size | 5.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6df55b83b8ff1f4d2069abdea9823c9475195c411711ff3a51bba9e09e492e70
|
|
BLAKE2b-256 checksum How to use checksums |
5e0319fd780fdb010918dbcf54086c425a0f1a78c3e456ac9d83ef63a8eb9a0b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.6.1 CPython/3.11.5 Darwin/21.6.0
|
Security for django-admin-form-action 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.