Skip to main content

TODO

Project description

Run tests for django-generic-admin-actions coveralls badge python: 3.7, 3.8, 3.9,3.9,3.10 django: 2.2, 3.0, 3.1, 3.2, 4.0, 4.1, 4.2

Description

Django-generic-admin-actions are admin actions without an item selection. They work exactly like original admin actions but without taking a queryset. This is useful for actions that are model (and not object) related or that should manipulate model objects as a whole.

Installation

Install from pypi.org:

pip install django-generic-admin-actions

Getting started

Add generic_admin_actions to your installed apps:

INSTALLED_APPS = [
    'generic_admin_actions',
    'django.contrib.admin',
    ...
]

Since we overwrite the change_list.html template the app must be listed before django’s admin-site.

Use the GenericActionsMixin for your ModelAdmin classes and add some actions:

from django.contrib import admin
from generic_admin_actions import GenericActionsMixin

def my_action(modeladmin, request):
    # Do some stuff here.

class MyModelAdmin(GenericActionsMixin, admin.ModelAdmin):
    ...
    generic_actions = [
        my_action,
        ...
    ]

Generic admin actions working all the same as original admin actions with the difference that their don’t take a queryset. So for more advanced setups like actions with intermediate pages please follow django’s official documentation.

Usage

On your model’s change-list-view choose the generic action from the dropdown and press the “Go” button.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-generic-admin-actions-0.3.tar.gz (10.8 kB view hashes)

Uploaded Source

Built Distribution

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page