{"id":23553,"library":"django-admin-extra-buttons","title":"django-admin-extra-buttons","description":"Django mixin to easily add custom buttons to any ModelAdmin, change form, or changelist. Current version is 2.2, requires Python >=3.12 and Django >=4.2 (implicitly). The library is actively maintained with regular releases.","status":"active","version":"2.2","language":"python","source_language":"en","source_url":"https://github.com/saxix/django-admin-extra-buttons","tags":["django","admin","buttons","mixins","extra-buttons","django-admin"],"install":[{"cmd":"pip install django-admin-extra-buttons","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"Required Django admin integration; version >=4.2 (implied by Python 3.12+ support).","package":"Django","optional":false}],"imports":[{"note":"ExtraButtonsMixin is in the mixins submodule.","wrong":"from admin_extra_buttons import ExtraButtonsMixin","symbol":"ExtraButtonsMixin","correct":"from admin_extra_buttons.mixins import ExtraButtonsMixin"},{"note":"Decorator to mark a method as an extra button.","wrong":null,"symbol":"button","correct":"from admin_extra_buttons.decorators import button"},{"note":"Decorator to create a dropdown choice button.","wrong":null,"symbol":"choice","correct":"from admin_extra_buttons.decorators import choice"},{"note":"Decorator to create a link button.","wrong":null,"symbol":"link","correct":"from admin_extra_buttons.decorators import link"},{"note":"Decorator to create a custom view button.","wrong":null,"symbol":"view","correct":"from admin_extra_buttons.decorators import view"}],"quickstart":{"code":"from django.contrib import admin\nfrom admin_extra_buttons.mixins import ExtraButtonsMixin\nfrom admin_extra_buttons.decorators import button\nfrom django.http import HttpResponse\n\nclass MyModelAdmin(ExtraButtonsMixin, admin.ModelAdmin):\n    @button(label='Say Hello', permission='some_app.can_view')\n    def say_hello(self, request):\n        return HttpResponse('Hello!')\n\nadmin.site.register(MyModel, MyModelAdmin)","lang":"python","description":"Add a custom button to a ModelAdmin using ExtraButtonsMixin and the button decorator."},"warnings":[{"fix":"Upgrade to Django >=3.2 and Python >=3.8. Review custom get_urls() overrides for compatibility with new URL patterns.","message":"Version 2.0 dropped support for Django <3.2 and Python <3.8. If upgrading from 1.x, review changes in get_urls() method and ensure your custom views are compatible.","severity":"breaking","affected_versions":">=2.0"},{"fix":"Use 'app_label.permission_codename' string format. For dynamic checks, use Django's perms in the request.","message":"The button decorator's `permission` argument is a string, not a callable. Using a callable will cause a TypeError or be ignored.","severity":"gotcha","affected_versions":"all"},{"fix":"Define button methods separately from list display methods.","message":"When using @choice or @button on methods that also have @admin.display, the button will not render properly. Do not mix these decorators.","severity":"gotcha","affected_versions":"all"},{"fix":"Refactor to use decorators (@button, @choice, @link, @view) instead of defining buttons dict.","message":"The `buttons` property (list of dicts) is deprecated in favor of the decorator-based approach as of v1.6. It will be removed in a future release.","severity":"deprecated","affected_versions":">=1.6 <3.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Ensure your ModelAdmin inherits from ExtraButtonsMixin first. Example: class MyModelAdmin(ExtraButtonsMixin, admin.ModelAdmin):","cause":"Trying to use button as a method without decorating or mixing in ExtraButtonsMixin.","error":"AttributeError: 'MyModelAdmin' object has no attribute 'button'"},{"fix":"Add @button decorator above the method and ensure the method is inside the admin class with ExtraButtonsMixin.","cause":"Missing @button decorator or misspelled method name (extra_buttons expects decorated methods).","error":"django.core.exceptions.ImproperlyConfigured: The 'extra_buttons' attribute 'button' does not exist on model admin 'MyModelAdmin'"},{"fix":"Upgrade to latest version: pip install --upgrade django-admin-extra-buttons","cause":"Using an older version (<1.6) where permission argument is not supported.","error":"TypeError: button() got an unexpected keyword argument 'permission'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}