https://github.com/lukasvinclav/django-admin-actions
Display Django admin custom actions in changelist, changeview or per row in changelist.
https://github.com/lukasvinclav/django-admin-actions
admin django django-admin object-tools python
Last synced: 6 months ago
JSON representation
Display Django admin custom actions in changelist, changeview or per row in changelist.
- Host: GitHub
- URL: https://github.com/lukasvinclav/django-admin-actions
- Owner: lukasvinclav
- License: mit
- Created: 2018-09-04T17:18:54.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2022-08-31T18:12:35.000Z (almost 4 years ago)
- Last Synced: 2025-09-18T17:37:02.361Z (9 months ago)
- Topics: admin, django, django-admin, object-tools, python
- Language: Python
- Homepage:
- Size: 577 KB
- Stars: 36
- Watchers: 2
- Forks: 10
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README

# 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
1. Installation
```bash
pip install django-admin-actions
```
```bash
pip install git+https://git@github.com/lukasvinclav/django-admin-actions.git
```
2. Add **admin_actions** into **INSTALLED_APPS** in your settings file before **django.contrib.admin**.
## Sample admin configuration
```python
from django.contrib import admin
from django.shortcuts import redirect
from django.urls import reverse_lazy
from django.utils.translations import ugettext_lazy as _
from admin_actions.admin import ActionsModelAdmin
from .models import ExampleModel
@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'
```