Jump to >

AdminWidgetHook

New in version 2.5.

reviewboard.extensions.hooks.AdminWidgetHook allows extensions to register new widgets for the administration dashboard.

Extensions must provide a subclass of reviewboard.admin.widgets.Widget, and pass it as a parameter to AdminWidgetHook. Each class must provide widget_id and title attributes, and should provide a template.

Example

from django.utils.translation import ugettext_lazy as _
from reviewboard.admin.widgets import Widget
from reviewboard.extensions.base import Extension
from reviewboard.extensions.hooks import AdminWidgetHook


class SampleWidget(Widget):
    widget_id = 'myvendor_sample_widget'
    title = _('Sample Widget')
    template = 'sample/widgets/sample-widget.html'


class SampleExtension(Extension):
    def initialize(self):
        AdminWidgetHook(self, SampleWidget)