Skip to main content

Add toolbar in every item line in django's changelist view, and on top of django's changeform view.

Project description


Add toolbar in every item line in django's changelist view, and on top of django's changeform view.


pip install django-object-toolbar-admin



  • Add django_static_fontawesome and django_object_toolbar_admin applications in INSTALLED_APPS.


from django.contrib import admin
from django_object_toolbar_admin.admin import DjangoObjectToolbarAdmin
from .models import Category

class CategoryAdmin(DjangoObjectToolbarAdmin, admin.ModelAdmin):
    list_display = ["name", "django_object_toolbar", "my_toolbar"]

    django_object_toolbar_changeform_buttons = [
    # define default toolbar
    django_object_toolbar_buttons = [

    def print(self, obj):
        return "/print"
    print.icon = "fas fa-print"
    print.title = "Print"
    print.help_text = "Print the object information..."
    def export(self, obj):
        return "/export"
    export.icon = "fas fa-save"
    export.title = "Export"

    # define my toolbar
    def my_toolbar(self, obj):
        return self.get_django_object_toolbar("my_toolbar_buttons", obj)
    my_toolbar.short_description = "My Toolbar"

    my_toolbar_buttons = [

    def delete(self, obj):
        return "/delete"
    delete.icon = "fas fa-trash"
    delete.title = "Delete"

    def say_hi(self, obj):
        return "javascript:alert('hi {}');".format(
    say_hi.icon = "fas fa-music"
    say_hi.title = "Say Hi!", CategoryAdmin)
  • Buttons in django_object_toolbar_changeform_buttons will display on top of changeform view.
  • Buttons in django_object_toolbar_buttons or my_toolbar_buttons will display in every line in changelist view. You need to put django_object_toolbar or my_toolbar in list_display.
  • A button can be a method of admin or a method of model instance.
  • A button method returns the link of the button.
  • A button method tasks extra configs:
    • button.title
    • button.icon
    • button.help_text
    • button.klass



  • First release.


  • Fix Button.from_dict calling problem.
  • Add i18n.
  • Add app_requires.


  • Doc update.

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

django-object-toolbar-admin-0.1.2.tar.gz (7.1 kB view hashes)

Uploaded source

Built Distribution

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page