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.2.0 2020/02/26
- App rename to django_changelist_toolbar_admin.
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.2.0.tar.gz
.
File metadata
- Download URL: django-changelist-toolbar-admin-0.2.0.tar.gz
- Upload date:
- Size: 3.6 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 | 75894ddde478b0a691c0a0ceb6ca0e81140161a780f4f3c29c527def73fdf459 |
|
MD5 | 25e4dfdfd0e7900fbf626ab4c575c82a |
|
BLAKE2b-256 | f8c4df7a3fda824d119941e837ac8f910518d330f4a6c35f54cbd9193b04a7e0 |