Skip to main content

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 = [
    ...
    'django_static_fontawesome',
    'django_changelist_toolbar_admin',
    ...
]
  • django_static_fontawesome is required, for already include the fontawesome css in Media's css settings.

app/admin.py

from django.contrib import admin
from django_changelist_toolbar_admin.admin import DjangoChangelistToolbarAdmin
from .models import Category


class CategoryAdmin(DjangoChangelistToolbarAdmin, admin.ModelAdmin):
    list_display = ["name"]
    search_fields = ["name"]

    django_changelist_toolbar_buttons = [
        "export_button",
        "say_hi_button",
    ]

    def export_button(self, request):
        return "/export"
    export_button.title = "Export"
    export_button.icon = "fas fa-file-export"
    export_button.target = "_blank"
    
    def say_hi_button(self, request):
        return {
            "href": "javascript:alert('hi');",
            "title": "Say Hi",
            "icon": "fas fa-music",
        } 

admin.site.register(Category, CategoryAdmin)
  • A button function must returns a Button instance, dict button info, or href.
  • Another way is override make_changelist_toolbar_button get return the final buttons.

Releases

v0.4.7

  • Doc update.

v0.4.6

  • Add data attr for toolbar button.

v0.4.5

  • Add button classes support.

v0.4.3

  • Doc update.
  • Add django-app-requires support.

v0.4.0

  • Fix document.
  • Rename configuration item changelist_toolbar_buttons to django_changelist_toolbar_buttons.

v0.3.0

  • The main class rename to DjangoChangelistToolbarAdmin. Mixin is a very simple abstract class that provides helper functions, but DjangoChangelistToolbarAdmin is complex base admin, so we remove the mixin suffix.

v0.2.0

  • App rename to django_changelist_toolbar_admin.

v0.1.0

  • First release.

Release files for django-changelist-toolbar-admin 0.4.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-changelist-toolbar-admin 0.4.7
File Size Uploaded
django_changelist_toolbar_admin-0.4.7.tar.gz 6.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-changelist-toolbar-admin 0.4.7
File Interpreter ABI Platform
django_changelist_toolbar_admin-0.4.7-py3-none-any.whl Python 3 none any Details

Total release size: 13.4 kB

Release files / django_changelist_toolbar_admin-0.4.7.tar.gz

Download URL django_changelist_toolbar_admin-0.4.7.tar.gz
Size 6.5 kB
Tags Source
SHA-256 checksum
How to use checksums
907c465bdba6c19e774e7647535e5f021215ed4c2ac20cd10e153932bfdbcf58
BLAKE2b-256 checksum
How to use checksums
7dee084af6cc7a4ee3b40fbc7e928137f2763e5e544b1409199546f803aa97f7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.12

Release files / django_changelist_toolbar_admin-0.4.7-py3-none-any.whl

Download URL django_changelist_toolbar_admin-0.4.7-py3-none-any.whl
Size 7.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
72298ff624785ea798b01948a7793bc5a137d3efcdfd2abb4bb0059429414a41
BLAKE2b-256 checksum
How to use checksums
404d7e4cf001fbe29ffea1e6418363f25a753602d02967a3f6d1c980143675f6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.12

Release history Release notifications | RSS feed

This release

0.4.7 This release

2 release files

0.4.5

2 release files

0.4.3

2 release files

0.4.0

1 release file

0.3.0

1 release file

0.2.0

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page