reviewboard.datagrids.grids¶
Datagrids for the Dashboard and other pages.
- class ShowClosedReviewRequestsMixin[source]¶
Bases:
object
A mixin for showing or hiding closed review requests.
- class DataGridJSMixin(*args, **kwargs)[source]¶
Bases:
object
Mixin that provides enhanced JavaScript support for datagrids.
This contains additional information on the JavaScript views/models to load for the page, allowing for enhanced functionality in datagrids.
- periodic_reload = False[source]¶
Whether or not to periodically reload the contents of the datagrid.
- __init__(*args, **kwargs)[source]¶
Initialize the mixin.
This will pull out the Local Site, which is common to all datagrids, and store it for later use and for JavaScript attribute population.
- get_js_model_attrs()[source]¶
Return attributes for the JavaScript model.
These will be passed to the model specified in
js_model_class
during construction.Subclasses can override this to provide additional data.
- Returns:
Attributes to provide to the JavaScript model.
- Return type:
- get_js_model_options()[source]¶
Return options for the JavaScript model.
These will be passed to the model specified in
js_model_class
during construction.Subclasses can override this to provide additional data.
- Returns:
Options to provide to the JavaScript model.
- Return type:
- get_js_view_options()[source]¶
Return options for the JavaScript view.
These will be passed to the view specified in
js_view_class
during construction.Subclasses can override this to provide additional data.
- Returns:
Options to provide to the JavaScript view.
- Return type:
- class DataGrid(*args, **kwargs)[source]¶
Bases:
DataGridJSMixin
,DataGrid
Base class for a datagrid in Review Board.
This contains additional information on JavaScript views/models to load for the page.
- __annotations__ = {}¶
- class AlphanumericDataGrid(*args, **kwargs)[source]¶
Bases:
DataGridJSMixin
,AlphanumericDataGrid
Base class for an alphanumeric datagrid in Review Board.
This contains additional information on JavaScript views/models to load for the page.
- __annotations__ = {}¶
- class ReviewRequestDataGrid(*args, **kwargs)[source]¶
Bases:
ShowClosedReviewRequestsMixin
,DataGrid
A datagrid that displays a list of review requests.
This datagrid accepts the show_closed parameter in the URL, allowing submitted review requests to be filtered out or displayed.
- post_process_queryset(queryset: QuerySet[ReviewRequest]) QuerySet[ReviewRequest] [source]¶
Add additional data to the queryset.
- Parameters:
queryset (
django.db.models.QuerySet
) – The queryset to post-process.- Returns:
The resulting queryset.
- Return type:
django.db.models.QuerySet
- __annotations__ = {'_model': 'Optional[Type[Model]]', 'cell_template': 'str', 'column_map': 'Dict[Column, StatefulColumn]', 'columns': 'List[StatefulColumn]', 'custom_header_template': 'str', 'default_columns': 'List[str]', 'default_sort': 'List[str]', 'extra_context': '_RenderContext', 'id': 'str', 'id_list': 'List[Any]', 'listview_template': 'str', 'optimize_sorts': 'bool', 'page': 'Optional[Page]', 'page_num': 'int', 'paginate_by': 'int', 'paginate_orphans': 'int', 'paginator': 'Optional[DataGridPaginator]', 'paginator_template': 'str', 'profile_columns_field': 'Optional[str]', 'profile_sort_field': 'Optional[str]', 'rows': 'List[_DataGridRow]', 'sort_list': 'Optional[List[str]]', 'special_query_args': 'List[str]', 'state_loaded': 'bool', 'title': 'StrOrPromise', 'use_distinct': 'bool'}¶
- class ReviewDataGrid(*args, **kwargs)[source]¶
Bases:
ShowClosedReviewRequestsMixin
,DataGrid
A datagrid that displays a list of reviews.
This datagrid accepts the show_closed parameter in the URL, allowing submitted review requests to be filtered out or displayed.
- post_process_queryset(queryset: QuerySet[Review]) QuerySet[Review] [source]¶
Add additional data to the queryset.
- Parameters:
queryset (
django.db.models.QuerySet
) – The queryset to post-process.- Returns:
The resulting queryset.
- Return type:
django.db.models.QuerySet
- __annotations__ = {'_model': 'Optional[Type[Model]]', 'cell_template': 'str', 'column_map': 'Dict[Column, StatefulColumn]', 'columns': 'List[StatefulColumn]', 'custom_header_template': 'str', 'default_columns': 'List[str]', 'default_sort': 'List[str]', 'extra_context': '_RenderContext', 'id': 'str', 'id_list': 'List[Any]', 'listview_template': 'str', 'optimize_sorts': 'bool', 'page': 'Optional[Page]', 'page_num': 'int', 'paginate_by': 'int', 'paginate_orphans': 'int', 'paginator': 'Optional[DataGridPaginator]', 'paginator_template': 'str', 'profile_columns_field': 'Optional[str]', 'profile_sort_field': 'Optional[str]', 'rows': 'List[_DataGridRow]', 'sort_list': 'Optional[List[str]]', 'special_query_args': 'List[str]', 'state_loaded': 'bool', 'title': 'StrOrPromise', 'use_distinct': 'bool'}¶
- class DashboardDataGrid(*args, **kwargs)[source]¶
Bases:
DataGridSidebarMixin
,ReviewRequestDataGrid
Displays the dashboard.
The dashboard is the main place where users see what review requests are out there that may need their attention.
- load_extra_state(profile: Profile) List[str] [source]¶
Load extra state for the datagrid.
- Parameters:
profile (
reviewboard.accounts.models.Profile
) – The profile containing state for customizing the dashboard.- Returns:
A list of profile fields that have changed.
- Return type:
- __annotations__ = {'_model': 'Optional[Type[Model]]', 'cell_template': 'str', 'column_map': 'Dict[Column, StatefulColumn]', 'columns': 'List[StatefulColumn]', 'custom_header_template': 'str', 'default_columns': 'List[str]', 'default_sort': 'List[str]', 'extra_context': '_RenderContext', 'id': 'str', 'id_list': 'List[Any]', 'listview_template': 'str', 'optimize_sorts': 'bool', 'page': 'Optional[Page]', 'page_num': 'int', 'paginate_by': 'int', 'paginate_orphans': 'int', 'paginator': 'Optional[DataGridPaginator]', 'paginator_template': 'str', 'profile_columns_field': 'Optional[str]', 'profile_sort_field': 'Optional[str]', 'rows': 'List[_DataGridRow]', 'sort_list': 'Optional[List[str]]', 'special_query_args': 'List[str]', 'state_loaded': 'bool', 'title': 'StrOrPromise', 'use_distinct': 'bool'}¶
- class UsersDataGrid(request: HttpRequest, queryset: QuerySet[User] = <QuerySet [<User: admin>, <User: doc>, <User: dopey>, <User: grumpy>]>, title: StrOrPromise = 'All users', local_site: Optional[LocalSite] = None)[source]¶
Bases:
AlphanumericDataGrid
A datagrid showing a list of users registered on Review Board.
- __init__(request: HttpRequest, queryset: QuerySet[User] = <QuerySet [<User: admin>, <User: doc>, <User: dopey>, <User: grumpy>]>, title: StrOrPromise = 'All users', local_site: Optional[LocalSite] = None) None [source]¶
Initialize the datagrid.
- Parameters:
request (
django.http.HttpRequest
) – The HTTP request from the client.queryset (
django.db.models.QuerySet
, optional) – The base queryset for this datagrid.title (
str
, optional) – The title for this datagrid.local_site (
reviewboard.site.models.LocalSite
, optional) – The Local Site being accessed.
- load_extra_state(profile)[source]¶
Load extra state for the datagrid.
This handles hiding or showing inactive users.
- Parameters:
profile (
reviewboard.accounts.models.Profile
) – The user profile which contains some basic configurable settings.- Returns:
Always returns False.
- Return type:
- post_process_queryset_for_data(queryset: QuerySet, **kwargs) QuerySet [source]¶
Add additional lookups for the datagrid’s queryset
This will add any column-specific queries to the queryset, and then select-related the Local Sites so that operations that require the Local Site relation can be conducted without an additional query.
New in version 5.0.7.
- Parameters:
queryset (
django.db.models.query.QuerySet
) – The queryset to augment.**kwargs (
dict
) – Additional keyword arguments for future expansion.
- Returns:
The resulting augmented QuerySet.
- Return type:
- __annotations__ = {'_model': 'Optional[Type[Model]]', 'cell_template': 'str', 'column_map': 'Dict[Column, StatefulColumn]', 'columns': 'List[StatefulColumn]', 'current_letter': 'str', 'custom_header_template': 'str', 'default_columns': 'List[str]', 'default_sort': 'List[str]', 'extra_context': '_RenderContext', 'id': 'str', 'id_list': 'List[Any]', 'listview_template': 'str', 'optimize_sorts': 'bool', 'page': 'Optional[Page]', 'page_num': 'int', 'paginate_by': 'int', 'paginate_orphans': 'int', 'paginator': 'Optional[DataGridPaginator]', 'paginator_template': 'str', 'profile_columns_field': 'Optional[str]', 'profile_sort_field': 'Optional[str]', 'rows': 'List[_DataGridRow]', 'sort_list': 'Optional[List[str]]', 'special_query_args': 'List[str]', 'state_loaded': 'bool', 'title': 'StrOrPromise', 'use_distinct': 'bool'}¶
- class GroupDataGrid(request, title='All groups', *args, **kwargs)[source]¶
Bases:
DataGrid
A datagrid showing a list of review groups accessible by the user.
- post_process_queryset_for_data(queryset: QuerySet, **kwargs) QuerySet [source]¶
Add additional lookups for the datagrid’s queryset
This will add any column-specific queries to the queryset, and then select-related the Local Sites so that operations that require the Local Site relation can be conducted without an additional query.
New in version 5.0.7.
- Parameters:
queryset (
django.db.models.query.QuerySet
) – The queryset to augment.**kwargs (
dict
) – Additional keyword arguments for future expansion.
- Returns:
The resulting augmented QuerySet.
- Return type:
- __annotations__ = {'_model': 'Optional[Type[Model]]', 'cell_template': 'str', 'column_map': 'Dict[Column, StatefulColumn]', 'columns': 'List[StatefulColumn]', 'custom_header_template': 'str', 'default_columns': 'List[str]', 'default_sort': 'List[str]', 'extra_context': '_RenderContext', 'id': 'str', 'id_list': 'List[Any]', 'listview_template': 'str', 'optimize_sorts': 'bool', 'page': 'Optional[Page]', 'page_num': 'int', 'paginate_by': 'int', 'paginate_orphans': 'int', 'paginator': 'Optional[DataGridPaginator]', 'paginator_template': 'str', 'profile_columns_field': 'Optional[str]', 'profile_sort_field': 'Optional[str]', 'rows': 'List[_DataGridRow]', 'sort_list': 'Optional[List[str]]', 'special_query_args': 'List[str]', 'state_loaded': 'bool', 'title': 'StrOrPromise', 'use_distinct': 'bool'}¶
- class UserPageDataGridMixin[source]¶
Bases:
DataGridSidebarMixin
An abstract class for data grids on the user page.
This will display information about the user on the side.
- __annotations__ = {}¶
- class UserPageReviewRequestDataGrid(request, user, *args, **kwargs)[source]¶
Bases:
UserPageDataGridMixin
,ReviewRequestDataGrid
A data grid for the user page.
This will show the review requests the user has out for review.
- __annotations__ = {'_model': 'Optional[Type[Model]]', 'cell_template': 'str', 'column_map': 'Dict[Column, StatefulColumn]', 'columns': 'List[StatefulColumn]', 'custom_header_template': 'str', 'default_columns': 'List[str]', 'default_sort': 'List[str]', 'extra_context': '_RenderContext', 'id': 'str', 'id_list': 'List[Any]', 'listview_template': 'str', 'optimize_sorts': 'bool', 'page': 'Optional[Page]', 'page_num': 'int', 'paginate_by': 'int', 'paginate_orphans': 'int', 'paginator': 'Optional[DataGridPaginator]', 'paginator_template': 'str', 'profile_columns_field': 'Optional[str]', 'profile_sort_field': 'Optional[str]', 'rows': 'List[_DataGridRow]', 'sort_list': 'Optional[List[str]]', 'special_query_args': 'List[str]', 'state_loaded': 'bool', 'title': 'StrOrPromise', 'use_distinct': 'bool'}¶
- class UserPageReviewsDataGrid(request, user, *args, **kwargs)[source]¶
Bases:
UserPageDataGridMixin
,ReviewDataGrid
A data grid for the user page.
This will show reviews the user has made on other review requests.
- __annotations__ = {'_model': 'Optional[Type[Model]]', 'cell_template': 'str', 'column_map': 'Dict[Column, StatefulColumn]', 'columns': 'List[StatefulColumn]', 'custom_header_template': 'str', 'default_columns': 'List[str]', 'default_sort': 'List[str]', 'extra_context': '_RenderContext', 'id': 'str', 'id_list': 'List[Any]', 'listview_template': 'str', 'optimize_sorts': 'bool', 'page': 'Optional[Page]', 'page_num': 'int', 'paginate_by': 'int', 'paginate_orphans': 'int', 'paginator': 'Optional[DataGridPaginator]', 'paginator_template': 'str', 'profile_columns_field': 'Optional[str]', 'profile_sort_field': 'Optional[str]', 'rows': 'List[_DataGridRow]', 'sort_list': 'Optional[List[str]]', 'special_query_args': 'List[str]', 'state_loaded': 'bool', 'title': 'StrOrPromise', 'use_distinct': 'bool'}¶