Skip to main content

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


Release history Release notifications

Download files

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

Files for django-changelist-toolbar-admin, version 0.1.0
Filename, size File type Python version Upload date Hashes
Filename, size django-changelist-toolbar-admin-0.1.0.tar.gz (3.5 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page