Jump to >

Extension Class

The main component of an extension is a class inheriting from reviewboard.extensions.base.Extension. It can optionally set the following attributes on the class:

  • apps
  • context_processors
  • css_bundles
  • default_settings
  • has_admin_site
  • is_configurable
  • js_bundles
  • js_extensions
  • metadata
  • middleware
  • requirements
  • resources

The following are also available on an extension instance:

  • settings
class reviewboard.extensions.base.Extension

A list of Django apps that the extension either provides or depends upon.

Each “app” is a Python module path that Django will use when looking for models, template tags, and more.

This does not need to include the app for the extension itself, but if the extension is grouped into separate Django apps, it can list those.

This setting is equivalent to modifying settings.INSTALLED_APPS in Django.


A list of Django context processors, which inject variables into every rendered template. Certain third-party apps depend on context processors.

This setting is equivalent to modifying settings.TEMPLATE_CONTEXT_PROCESSORS in Django.


A list of custom CSS media bundles that can be used when rendering pages.

See Static Files for more information.


A dictionary of default settings for the extension. These defaults are used when accessing settings, if the user hasn’t provided a custom value. By default, this is empty.

See Default Settings for more information.


A boolean that indicates whether a Django admin site should be generated for the extension.

If True, a Database link will be shown for the extension, allowing the user to inspect and modify the extension’s database entries. The default is False.

See Admin Site (Database Browser) for more information.


A boolean indicating whether the extension supports global configuration by a system administrator.

If True, a Configure link will be shown for the extension when enabled, taking them to the configuration page provided by the extension. The default is False.

See Configuration Pages for more information.


A list of custom JavaScript media bundles that can be used when rendering pages.

See Static Files for more information.


A list of reviewboard.extensions.base.JSExtension subclasses used for providing JavaScript-side extensions.

See js-extensions for more information.


A dictionary providing additional information on the extension, such as the name or a description.

By default, the metadata from setup.py is used when displaying information about the extension inside the administration UI. Extensions can override what the user sees by setting the values in this dictionary.

The following metadata keys are supported:

The human-readable name of the extension, shown in the extension list.
The version of the extension. Usually, the version specified in setup.py suffices.
A brief summary of the extension, shown in the extension list.
A longer description of the extension. As of Review Board 2.0, this is not shown to the user, but it may be used in a future release.
The individual or company that authored the extension.
The contact e-mail address for the author of the extension.
The URL to the author’s public site.
The URL to the extension’s public site.

We generally recommend setting Name, Summary, and the author information. Version is usually best left to the package, unless there’s a special way it should be presented.


A list of Django middleware classes, which hook into various levels of the HTTP request/response and page render process.

This is an advanced feature, and is generally not needed by most extensions. Certain third-party apps may depend on middleware, though.

This setting is equivalent to modifying settings.MIDDLEWARE_CLASSES in Django.


A list of strings providing the names of other extensions the extension requires. Enabling the extension will in turn enable all required extensions, and can only be enabled if the required extensions can also be enabled.

See Dependencies for more information.


An instance of djblets.extensions.settings.Settings. This attribute gives each extension an easy-to-use and persistent data store for settings.

See Settings for more information.


A list of reviewboard.webapi.resources.WebAPIResource subclasses. This is used to extend the Web API.

See Extending the Web API for more information.