No project description provided
Project description
django-admin-actions
django-admin-actions provides simple way how to define custom actions for Django admin changelist, changeview and per row in changelist.
Getting started
- Installation
pip install django-admin-actions
pip install git+https://git@github.com/lukasvinclav/django-admin-actions.git
- Add admin_admin_actions into INSTALLED_APPS in your settings file before django.contrib.admin.
Sample admin configuration
from django.contrib import admin
from django.shortcuts import redirect
from django.urls import reverse_lazy
from .models import ExampleModel
from admin_actions.admin import ActionsModelAdmin
@admin.register(ExampleModel)
class CustomAdmin(ActionsModelAdmin):
actions_list = ('custom_list_action', )
actions_row = ('custom_row_action', )
actions_detail = ('custom_detail_action', )
def custom_list_action(self, request):
# custom logic here
return redirect(reverse_lazy('admin:APP_MODEL_changelist'))
custom_list_action.short_description = _('Custom name')
custom_list_action.url_path = 'clean-url-path-1'
def custom_row_action(self, request, pk):
# custom logic here
return redirect(reverse_lazy('admin:APP_MODEL_changelist'))
custom_row_action.short_description = _('Row custom name')
custom_row_action.url_path = 'clean-url-path-2'
def custom_detail_action(self, request, pk):
# custom logic here
return redirect(reverse_lazy('admin:APP_MODEL_changelist'))
custom_detail_action.short_description = _('Detail custom name')
custom_detail_action.url_path = 'clean-url-path-3'
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Close
Hashes for django-admin-actions-0.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2dc236e22f836fabdcf411a89fa34630febc683cfcd022adb264d35e454516ac |
|
MD5 | 70740b0df8edb5483b32e69a47883fd6 |
|
BLAKE2b-256 | ed3342f800cd6e17c82334c4da986812e0ca5934f0d82ca8c12a31efe8a0b05e |