Jump to >


class Widget[source]

Bases: object

The base class for an Administration Dashboard widget.

Widgets appear in the Administration Dashboard and can display useful information on the system, links to other pages, or even fetch data from external sites.

There are a number of built-in widgets, but extensions can provide their own.

SMALL = u'small'[source]
LARGE = u'large'[source]
widget_id = None[source]
title = None[source]
size = u'small'[source]
template = None[source]
actions = [][source]
has_data = True[source]
cache_data = True[source]

Initialize the widget.


Render the widget.

This will render the HTML for a widget. It takes care of generating and caching the data, depending on the widget’s needs.


Generate data for the widget.

Widgets should override this to provide extra data to pass to the template. This will be available in ‘widget.data’.

If cache_data is True, this data will be cached for the day.


Generate a cache key for this widget’s data.

By default, the key takes into account the current day. If the widget is displaying specific to, for example, the user, this should be overridden to include that data in the key.


Get the sync_num, which is number to sync.

sync_num is number of update and initialized to 1 every day.

class UserActivityWidget[source]

Bases: reviewboard.admin.widgets.Widget

User activity widget.

Displays a pie chart of the active application users based on their last login dates.

widget_id = u'user-activity-widget'[source]
title = _(u'User Activity')[source]
size = u'large'[source]
template = u'admin/widgets/w-user-activity.html'[source]
actions = [{u'url': u'db/auth/user/add/', u'label': _(u'Add')}, {u'url': u'db/auth/user/', u'classes': u'btn-right', u'label': _(u'Manage Users')}][source]

Generate data for the widget.

class ReviewRequestStatusesWidget[source]

Bases: reviewboard.admin.widgets.Widget

Review request statuses widget.

Displays a pie chart showing review request by status.

widget_id = u'review-request-statuses-widget'[source]
title = _(u'Request Statuses')[source]
template = u'admin/widgets/w-request-statuses.html'[source]

Generate data for the widget.

class RepositoriesWidget[source]

Bases: reviewboard.admin.widgets.Widget

Shows a list of repositories in the system.

This widget displays a table with the most recent repositories, their types, and visibility.

widget_id = u'repositories-widget'[source]
title = _(u'Repositories')[source]
size = u'large'[source]
template = u'admin/widgets/w-repositories.html'[source]
actions = [{u'url': u'db/scmtools/repository/add/', u'label': _(u'Add')}, {u'url': u'db/scmtools/repository/', u'classes': u'btn-right', u'label': _(u'View All')}][source]

Generate data for the widget.


Generate a cache key for this widget’s data.

class ReviewGroupsWidget[source]

Bases: reviewboard.admin.widgets.Widget

Review groups widget.

Shows a list of recently created groups.

MAX_GROUPS = 5[source]
widget_id = u'review-groups-widget'[source]
title = _(u'Review Groups')[source]
template = u'admin/widgets/w-groups.html'[source]
actions = [{u'url': u'db/reviews/group/', u'classes': u'btn-right', u'label': _(u'View All')}, {u'url': u'db/reviews/group/add/', u'label': _(u'Add')}][source]

Generate data for the widget.

class ServerCacheWidget[source]

Bases: reviewboard.admin.widgets.Widget

Cache statistics widget.

Displays a list of memcached statistics, if available.

widget_id = u'server-cache-widget'[source]
title = _(u'Server Cache')[source]
template = u'admin/widgets/w-server-cache.html'[source]
cache_data = False[source]

Generate data for the widget.

class NewsWidget[source]

Bases: reviewboard.admin.widgets.Widget

News widget.

Displays the latest news headlines from reviewboard.org.

widget_id = u'news-widget'[source]
title = _(u'Review Board News')[source]
template = u'admin/widgets/w-news.html'[source]
actions = [{u'url': u'https://www.reviewboard.org/news/', u'label': _(u'More')}, {u'id': u'reload-news', u'label': _(u'Reload')}][source]
has_data = False[source]
class DatabaseStatsWidget[source]

Bases: reviewboard.admin.widgets.Widget

Database statistics widget.

Displays a list of totals for several important database tables.

widget_id = u'database-stats-widget'[source]
title = _(u'Database Stats')[source]
template = u'admin/widgets/w-stats.html'[source]

Generate data for the widget.

class RecentActionsWidget[source]

Bases: reviewboard.admin.widgets.Widget

Recent actions widget.

Displays a list of recent admin actions to the user.

widget_id = u'recent-actions-widget'[source]
title = _(u'Recent Actions')[source]
template = u'admin/widgets/w-recent-actions.html'[source]
has_data = False[source]

Large database acitivity widget helper.

This method serves as a helper for the activity widget, it’s used with for AJAX requests based on date ranges passed to it.

class ActivityGraphWidget[source]

Bases: reviewboard.admin.widgets.Widget

Detailed database statistics graph widget.

Shows the latest database activity for multiple models in the form of a graph that can be navigated by date.

This widget shows a daily view of creation activity for a list of models. All displayed widget data is computed on demand, rather than up-front during creation of the widget.

widget_id = u'activity-graph-widget'[source]
title = _(u'Review Board Activity')[source]
size = u'large'[source]
template = u'admin/widgets/w-stats-large.html'[source]
actions = [{u'id': u'db-stats-graph-prev', u'rel': u'prev', u'label': u'<'}, {u'id': u'db-stats-graph-next', u'rel': u'next', u'label': u'>'}, {u'classes': u'btn-s btn-s-checked', u'rel': u'reviews', u'label': _(u'Reviews')}, {u'classes': u'btn-s btn-s-checked', u'rel': u'comments', u'label': _(u'Comments')}, {u'classes': u'btn-s btn-s-checked', u'rel': u'review_requests', u'label': _(u'Review Requests')}, {u'classes': u'btn-s btn-s-checked', u'rel': u'change_descriptions', u'label': _(u'Changes')}][source]
has_data = False[source]

Initialize the widgets subsystem.

This will listen for events in order to manage the widget caches.

register_admin_widget(widget_cls, primary=False)[source]

Register an administration widget.

This widget will appear in the list of primary or secondary widgets.

The widget class must have a widget_id attribute set, and can only be registerd once in a single list. A KeyError will be thrown if attempting to register a second time.


Unregister a previously registered administration widget.