Provides custom button management function on changelist page of django admin site.
Project description
django-changelist-toolbar-admin
Provides custom button management function on changelist page of django admin site.
Install
pip install django-changelist-toolbar-admin
Usage
pro/settings.py
INSTALLED_APPS = [
...
'fontawesome',
'changelist_toolbar',
...
]
app/admin.py
from django.contrib import admin
from changelist_toolbar.admin import ChangelistToolbarAdminMixin
from .models import Category
class CategoryAdmin(ChangelistToolbarAdminMixin, admin.ModelAdmin):
list_display = ["name"]
search_fields = ["name"]
changelist_toolbar_buttons = [
"export",
"say_hi",
]
def export(self, request):
return "/export"
export.title = "Export"
export.icon = "fas fa-file-export"
export.target = "_blank"
def say_hi(self, request):
return {
"href": "javascript:alert('hi');",
"title": "Say Hi",
"icon": "fas fa-music",
}
admin.site.register(Category, CategoryAdmin)
Releases
v0.1.0 2020/02/13
- First release.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file django-changelist-toolbar-admin-0.1.0.tar.gz
.
File metadata
- Download URL: django-changelist-toolbar-admin-0.1.0.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.40.0 CPython/3.7.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 26be0b8ea28711153d6ba7a902af2d368bd5a379141060ddb8eef98ca42c7644 |
|
MD5 | 9c62d6c1210e954d056fde092881a4ef |
|
BLAKE2b-256 | 6d66acab95a8625621f0c890a13fc64360a66e7670b1d1b4ef391c8c1183cdc2 |