django-form-action
Django action with an intermediate page to parse data from a form
Installation
You can install the package via pip:
pip install django-form-action
Add django_form_action to INSTALLED_APPS.
Demo
Usage
Example usage showing an action in UserAdmin which has an intermediate form that parses data on how to perform that action.
from typing import Any
from django.contrib import admin
from django.contrib import messages
from django.contrib.auth.admin import UserAdmin
from django.contrib.auth.models import User
from django.db.models import QuerySet
from django.forms import CharField
from django.forms import Form
from django.http import HttpRequest
from django_form_action import form_action
admin.site.unregister(User)
class ChangeFirstName(Form):
first_name = CharField()
@form_action(
User,
ChangeFirstName,
"Change selected users' first name",
)
def change_first_name(
modeladmin: "admin.ModelAdmin[User]",
request: HttpRequest,
queryset: QuerySet[User],
form: ChangeFirstName,
):
queryset.update(first_name=form.cleaned_data["first_name"])
messages.add_message(
request,
messages.INFO,
"Successfully changed the first name of selected users.",
)
@admin.register(User)
class CustomUserAdmin(UserAdmin):
actions = [change_first_name]
License
This project is licensed under the terms of the MIT license.
Metadata
Release files for django-form-action 3.0.1
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 | |
|---|---|---|---|---|
| django_form_action-3.0.1.tar.gz | 4.7 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| django_form_action-3.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 10.6 kB
Release files / django_form_action-3.0.1.tar.gz
| Download URL | django_form_action-3.0.1.tar.gz |
|---|---|
| Size | 4.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b3f30d4522a5faf48fc15dc79e8759da2e3500003630f8f752dd5b46bc923b86
|
|
BLAKE2b-256 checksum How to use checksums |
e756bfe526592f4be1af45716d2e769626af27c90478f82292c2c401004e4785
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.23
|
Release files / django_form_action-3.0.1-py3-none-any.whl
| Download URL | django_form_action-3.0.1-py3-none-any.whl |
|---|---|
| Size | 5.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1aee6bfd0a23894b87e6f5b223f8c6169d865cc860884147be39ba08d16cf278
|
|
BLAKE2b-256 checksum How to use checksums |
d9c593a4a56916b0a60595470a0a61d0adffc0c7ae3e6fbe0b7120ba4d57dfba
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.23
|
Security for django-form-action 3.0.1
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.