Status: New
Owner: ----
Labels: Type-Enhancement Priority-Medium

New issue 3423 by Extensions: Allow custom datagrids to be used with DataGridSidebarItemsHook

*** For customer support, please post to
*** If you have a patch, please submit it to
*** Do not post confidential information in this enhancement request!

What version are you running?

Review Board 2.0.1

What's the URL of the page this enhancement relates to, if any?

The main dashboard.

Describe the enhancement and the motivation for it.

The full discussion is tracked here:

I would like to be able to add SidebarNavItems that add custom queries to the main dashboard.

I attempted this by writing my own DashboardDataGrid and SidebarSection, and then passing them both into DataGridSidebarItemsHook, but it seems that you need to pass a datagrid that already exists.

Here is a condensed version of the code I attempted for quick reference:

class MyDashboardDataGrid(DashboardDataGrid):
    def load_extra_state(self, profile):
        # pass custom queryset and change title
        view = self.request.GET.get('view', self.default_view)
q = Q(repository__name='MyRepo', target_groups__name='internal', status='P')

        if view == 'outstanding':
q = q & Q(shipit_count__lt=2, issue_open_count=0) # TODO: make sure the review isn't yours
                self.queryset = ReviewRequest.objects.filter(q)
self.title = _('Requests That Need Reviews (Reviews with # ship-its < 2, no open issues, not yours)')

        return super(MyDashboardDataGrid, self).load_extra_state(profile)

class MySidebarSection(BaseSidebarSection):
    label = 'My Dashboard'

    def get_items(self):
yield SidebarNavItem(self, 'Needs More Reviews', view_id='outstanding')

class MyDashboard(Extension):
    metadata = {
        'Name': 'My Dashboard',
        'Summary': 'Summary here',
    is_configurable = True

    def initialize(self):
        # Your extension initialization is done here.
DataGridSidebarItemsHook(self, MyDashboardDataGrid, [MySidebarSection])

What operating system are you using? What browser?

Windows and Ubuntu. Mostly Chrome.

Please provide any additional information below.


You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:

You received this message because you are subscribed to the Google Groups 
"reviewboard-issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
To post to this group, send email to
Visit this group at
For more options, visit

Reply via email to