reviewboard.datagrids.columns¶
Columns for datagrids.
- class BaseStarColumn(label: Optional[StrOrPromise] = None, id: Optional[str] = None, detailed_label: Optional[StrOrPromise] = None, detailed_label_html: Optional[str] = None, field_name: Optional[str] = None, db_field: Optional[str] = None, image_url: Optional[str] = None, image_class: Optional[str] = None, image_width: Optional[int] = None, image_height: Optional[int] = None, image_alt: Optional[str] = '', shrink: bool = False, expand: bool = False, sortable: bool = False, default_sort_dir: int = 0, link: bool = False, link_func: Optional[LinkObjectFunc] = None, link_css_class: Optional[Union[str, LinkCSSClassFunc]] = None, cell_clickable: bool = False, css_class: Union[str, BuildCSSClassFunc] = '')[source]¶
Bases:
ColumnIndicates if an item is starred.
This is the base class for all columns that deal with starring items.
The star is interactive, allowing the user to star or unstar the item.
- detailed_label: Optional[StrOrPromise] = 'Starred'[source]¶
A detailed label to display in the Edit Columns menu.
Defaults to
label.- Type:
- image_class: Optional[str] = 'rb-icon rb-icon-star-on'[source]¶
The CSS spritesheet icon class to use in the header/navigation menu.
- Type:
- augment_queryset(state: StatefulColumn, queryset: QuerySet) QuerySet[source]¶
Add additional queries to the queryset.
This will load the list of starrable object IDs to check in the starred list, and then set them in the user’s star cache for later rendering.
- Parameters:
state (
djblets.datagrid.grids.StatefulColumn) – The column state.queryset (
django.db.models.query.QuerySet) – The queryset to augment.
- Returns:
The resulting queryset.
- Return type:
- render_data(state: StatefulColumn, obj: StarrableObject) SafeString[source]¶
Return the rendered contents of the column.
- Parameters:
state (
djblets.datagrids.grids.StatefulColumn) – The state for the DataGrid instance.obj (
django.db.models.Model) – The starrable model object for the row.
- Returns:
The rendered data as HTML.
- Return type:
- get_raw_object_value(state: StatefulColumn, obj: StarrableObject) bool[source]¶
Return the raw value for the star state.
This will determine whether the object is starred and save it for lookup during rendering.
New in version 7.1.
- Parameters:
state (
djblets.datagrids.grids.StatefulColumn) – The state for the DataGrid instance.obj (
django.db.models.Model) – The starrable model object for the row.
- Returns:
The star state for the object.
- Return type:
- class UsernameColumn(user_relation: Sequence[str] | None = None, *args, **kwargs)[source]¶
Bases:
ColumnA column for showing a username and the user’s avatar.
The username and avatar will link to the user’s profile page and will show basic profile information when hovering over the link.
When constructing an instance of this column, the relation between the object being represented in the datagrid and the user can be specified as a tuple or list of field names forming a path to the user field.
- css_class: Union[str, BuildCSSClassFunc] = 'submitter-column'[source]¶
A function or string for CSS classes applied to the cell.
- Type:
strorcallable
- link: bool = True[source]¶
Whether the contents of the cell will be linked to a URL.
The URL used must be defined by either
link_funcorDataGrid.link_to_object().- Type:
- link_css_class: Optional[Union[str, LinkCSSClassFunc]] = 'user'[source]¶
A function or string for CSS classes applied to a link.
The CSS classes will be defined on the
<a>for the cell’s link wrapper. This is only used iflinkisTrue.- Type:
strorcallable
- __init__(user_relation: Sequence[str] | None = None, *args, **kwargs) None[source]¶
Initialize the column.
- get_user(obj: Any) RBUser[source]¶
Return the user associated with this object.
- Parameters:
obj (
object) – The object provided to the column.- Returns:
The resulting user.
- Return type:
- render_data(state: StatefulColumn, obj: Any) SafeString[source]¶
Render the user’s name and avatar as HTML.
- Parameters:
state (
djblets.datagrid.grids.StatefulColumn) – The column state.obj (
django.db.models.Model) – The object being rendered in the datagrid.
- Returns:
The HTML for the column.
- Return type:
- augment_queryset(state: StatefulColumn, queryset: QuerySet) QuerySet[source]¶
Add additional queries to the queryset.
This will select fields for the user and the user’s profile, to help with query performance.
- Parameters:
state (
djblets.datagrid.grids.StatefulColumn) – The column state.queryset (
django.db.models.query.QuerySet) – The queryset to augment.
- Returns:
The resulting queryset.
- Return type:
- class FullNameColumn(label: Optional[StrOrPromise] = None, id: Optional[str] = None, detailed_label: Optional[StrOrPromise] = None, detailed_label_html: Optional[str] = None, field_name: Optional[str] = None, db_field: Optional[str] = None, image_url: Optional[str] = None, image_class: Optional[str] = None, image_width: Optional[int] = None, image_height: Optional[int] = None, image_alt: Optional[str] = '', shrink: bool = False, expand: bool = False, sortable: bool = False, default_sort_dir: int = 0, link: bool = False, link_func: Optional[LinkObjectFunc] = None, link_css_class: Optional[Union[str, LinkCSSClassFunc]] = None, cell_clickable: bool = False, css_class: Union[str, BuildCSSClassFunc] = '')[source]¶
Bases:
ColumnShows the full name of the user when appropriate.
- augment_queryset(state: StatefulColumn, queryset: QuerySet) QuerySet[source]¶
Add additional queries to the queryset.
This will select fields for the user and the user’s profile, to help with query performance.
- Parameters:
state (
djblets.datagrid.grids.StatefulColumn) – The column state.queryset (
django.db.models.query.QuerySet) – The queryset to augment.
- Returns:
The resulting queryset.
- Return type:
- get_raw_object_value(state: StatefulColumn, obj: RBUser) str | None[source]¶
Return the raw value for the full name.
If the profile is private, the full name will not be provided.
New in version 7.1.
- Parameters:
state (
djblets.datagrids.grids.StatefulColumn) – The state for the DataGrid instance.obj (
reviewboard.accounts.models.User) – The user for the row.
- Returns:
The full name, or
Noneif the profile is private.- Return type:
- class BugsColumn(label: Optional[StrOrPromise] = None, id: Optional[str] = None, detailed_label: Optional[StrOrPromise] = None, detailed_label_html: Optional[str] = None, field_name: Optional[str] = None, db_field: Optional[str] = None, image_url: Optional[str] = None, image_class: Optional[str] = None, image_width: Optional[int] = None, image_height: Optional[int] = None, image_alt: Optional[str] = '', shrink: bool = False, expand: bool = False, sortable: bool = False, default_sort_dir: int = 0, link: bool = False, link_func: Optional[LinkObjectFunc] = None, link_css_class: Optional[Union[str, LinkCSSClassFunc]] = None, cell_clickable: bool = False, css_class: Union[str, BuildCSSClassFunc] = '')[source]¶
Bases:
ColumnShows the list of bugs specified on a review request.
The list of bugs will be linked to the bug tracker, if a bug tracker was configured for the repository the review request’s change is on.
- css_class: Union[str, BuildCSSClassFunc] = 'bugs'[source]¶
A function or string for CSS classes applied to the cell.
- Type:
strorcallable
- link: bool = False[source]¶
Whether the contents of the cell will be linked to a URL.
The URL used must be defined by either
link_funcorDataGrid.link_to_object().- Type:
- augment_queryset(state: StatefulColumn, queryset: QuerySet) QuerySet[source]¶
Add additional queries to the queryset.
This will include the repository along with each review request.
- Parameters:
state (
djblets.datagrid.grids.StatefulColumn) – The column state.queryset (
django.db.models.query.QuerySet) – The queryset to augment.
- Returns:
The resulting queryset.
- Return type:
- render_data(state: StatefulColumn, obj: ReviewRequest) SafeString[source]¶
Return the rendered contents of the column.
- Parameters:
state (
djblets.datagrid.grids.StatefulColumn) – The state for the DataGrid instance.obj (
reviewboard.reviews.models.ReviewRequest) – The review request being rendered for this row.
- Returns:
The rendered HTML.
- Return type:
- get_raw_object_value(state: StatefulColumn, obj: ReviewRequest) Sequence[_BugsColumnData][source]¶
Return the raw value for the bugs information.
This will return the list of bug IDs and URLs (if present) from the review request.
New in version 7.1.
- Parameters:
state (
djblets.datagrids.grids.StatefulColumn) – The state for the DataGrid instance.obj (
reviewboard.reviews.models.ReviewRequest) – The review request for the row.
- Returns:
The list of bug information.
- Return type:
listof_BugsColumnData
- class ReviewRequestCheckboxColumn(checkbox_name: str = 'select', shrink: bool = True, show_checkbox_header: bool = True, detailed_label: Optional[StrOrPromise] = 'Select Rows', *args, **kwargs)[source]¶
Bases:
CheckboxColumnA column containing a check-box.
- render_data(state: StatefulColumn, obj: ReviewRequest) SafeString[source]¶
Return the rendered contents of the column.
- Parameters:
state (
djblets.datagrid.grids.StatefulColumn) – The state for the DataGrid instance.obj (
reviewboard.reviews.models.ReviewRequest) – The review request being rendered for this row.
- Returns:
The rendered HTML.
- Return type:
- class DateTimeSinceColumn(label: StrOrPromise | None = None, format: str | None = None, sortable: bool = True, timezone: datetime.tzinfo = datetime.timezone.utc, *args, **kwargs)[source]¶
Bases:
DateTimeColumnDisplays how long it has been since a given date/time.
These columns will dynamically update as the page is shown, so that the number of minutes, hours, days, etc. ago is correct.
- render_data(state: StatefulColumn, obj: Any) SafeString[source]¶
Return the rendered contents of the column.
- Parameters:
state (
djblets.datagrid.grids.StatefulColumn) – The state for the DataGrid instance.obj (
object) – The object being rendered for this row.
- Returns:
The rendered HTML.
- Return type:
- class DiffUpdatedColumn(label: StrOrPromise | None = None, format: str | None = None, sortable: bool = True, timezone: datetime.tzinfo = datetime.timezone.utc, *args, **kwargs)[source]¶
Bases:
DateTimeColumnShows the date/time that the diff was last updated.
- label: Optional[StrOrPromise] = 'Diff Updated'[source]¶
The label to show in the column header.
- Type:
- db_field: str = 'diffset_history__last_diff_updated'[source]¶
The name of the database field containing the field used for sorting.
Once columns are populated for a datagrid, this is guaranteed to be set.
- Type:
- link: bool = False[source]¶
Whether the contents of the cell will be linked to a URL.
The URL used must be defined by either
link_funcorDataGrid.link_to_object().- Type:
- augment_queryset(state: StatefulColumn, queryset: QuerySet) QuerySet[source]¶
Add additional queries to the queryset.
This will include the diffset history along with each review request.
- Parameters:
state (
djblets.datagrid.grids.StatefulColumn) – The column state.queryset (
django.db.models.query.QuerySet) – The queryset to augment.
- Returns:
The resulting queryset.
- Return type:
- get_raw_object_value(state: StatefulColumn, obj: ReviewRequest) datetime | None[source]¶
Return the diff updated timestamp.
New in version 7.1.
- Parameters:
state (
djblets.datagrids.grids.StatefulColumn) – The state for the DataGrid instance.obj (
reviewboard.reviews.models.ReviewRequest) – The review request to return the value for.
- Returns:
The diff updated timestamp, or
Noneif there’s no diff.- Return type:
- class DiffUpdatedSinceColumn(label: StrOrPromise | None = None, format: str | None = None, sortable: bool = True, timezone: datetime.tzinfo = datetime.timezone.utc, *args, **kwargs)[source]¶
Bases:
DateTimeSinceColumnShows the elapsed time since the diff was last updated.
- label: Optional[StrOrPromise] = 'Diff Updated'[source]¶
The label to show in the column header.
- Type:
- db_field: str = 'diffset_history__last_diff_updated'[source]¶
The name of the database field containing the field used for sorting.
Once columns are populated for a datagrid, this is guaranteed to be set.
- Type:
- link: bool = False[source]¶
Whether the contents of the cell will be linked to a URL.
The URL used must be defined by either
link_funcorDataGrid.link_to_object().- Type:
- augment_queryset(state: StatefulColumn, queryset: QuerySet) QuerySet[source]¶
Add additional queries to the queryset.
This will include the diffset history along with each review request.
- Parameters:
state (
djblets.datagrid.grids.StatefulColumn) – The column state.queryset (
django.db.models.query.QuerySet) – The queryset to augment.
- Returns:
The resulting queryset.
- Return type:
- get_raw_object_value(state: StatefulColumn, obj: ReviewRequest) datetime | None[source]¶
Return the diff updated timestamp.
New in version 7.1.
- Parameters:
state (
djblets.datagrids.grids.StatefulColumn) – The state for the DataGrid instance.obj (
reviewboard.reviews.models.ReviewRequest) – The review request to return the value for.
- Returns:
The diff updated timestamp, or
Noneif there’s no diff.- Return type:
- class GroupMemberCountColumn(label: Optional[StrOrPromise] = None, id: Optional[str] = None, detailed_label: Optional[StrOrPromise] = None, detailed_label_html: Optional[str] = None, field_name: Optional[str] = None, db_field: Optional[str] = None, image_url: Optional[str] = None, image_class: Optional[str] = None, image_width: Optional[int] = None, image_height: Optional[int] = None, image_alt: Optional[str] = '', shrink: bool = False, expand: bool = False, sortable: bool = False, default_sort_dir: int = 0, link: bool = False, link_func: Optional[LinkObjectFunc] = None, link_css_class: Optional[Union[str, LinkCSSClassFunc]] = None, cell_clickable: bool = False, css_class: Union[str, BuildCSSClassFunc] = '')[source]¶
Bases:
ColumnShows the number of users that are part of a review group.
- link: bool = True[source]¶
Whether the contents of the cell will be linked to a URL.
The URL used must be defined by either
link_funcorDataGrid.link_to_object().- Type:
- augment_queryset_for_data(state: StatefulColumn, queryset: QuerySet, **kwargs) QuerySet[source]¶
Augment a queryset for data-rendering purposes.
This will count the number of group members for display.
New in version 5.0.7.
- Parameters:
state (
djblets.datagrid.grids.StatefulColumn) – The state for the DataGrid instance.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:
- render_data(state: StatefulColumn, obj: Group) SafeString[source]¶
Return the rendered contents of the column.
- Parameters:
state (
djblets.datagrid.grids.StatefulColumn) – The state for the DataGrid instance.obj (
reviewboard.reviews.models.group.Group) – The object being rendered for this row.
- Returns:
The rendered HTML.
- Return type:
- get_raw_object_value(state: StatefulColumn, obj: Group) int[source]¶
Return the raw value for the group membership count.
New in version 7.1.
- Parameters:
state (
djblets.datagrids.grids.StatefulColumn) – The state for the DataGrid instance.obj (
reviewboard.reviews.models.Group) – The review group for the row.
- Returns:
The group membership count.
- Return type:
- static link_func(state: StatefulColumn, obj: Group, value: str) str[source]¶
Return the link to the object in the column.
- Parameters:
state (
djblets.datagrid.grids.StatefulColumn) – The column state.obj (
reviewboard.reviews.models.Group) – The review group for the row.value (
str) – The rendered data.
- Returns:
The URL to link to.
- Return type:
- class GroupsColumn(label: Optional[StrOrPromise] = None, id: Optional[str] = None, detailed_label: Optional[StrOrPromise] = None, detailed_label_html: Optional[str] = None, field_name: Optional[str] = None, db_field: Optional[str] = None, image_url: Optional[str] = None, image_class: Optional[str] = None, image_width: Optional[int] = None, image_height: Optional[int] = None, image_alt: Optional[str] = '', shrink: bool = False, expand: bool = False, sortable: bool = False, default_sort_dir: int = 0, link: bool = False, link_func: Optional[LinkObjectFunc] = None, link_css_class: Optional[Union[str, LinkCSSClassFunc]] = None, cell_clickable: bool = False, css_class: Union[str, BuildCSSClassFunc] = '')[source]¶
Bases:
ColumnShows the list of groups requested to review the review request.
- detailed_label: Optional[StrOrPromise] = 'Target Groups'[source]¶
A detailed label to display in the Edit Columns menu.
Defaults to
label.- Type:
- shrink: bool = False[source]¶
Whether the column will shrink to the minimum size for the data.
- Type:
- augment_queryset(state: StatefulColumn, queryset: QuerySet) QuerySet[source]¶
Add additional queries to the queryset.
This will pre-fetch the review groups for each review request.
- Parameters:
state (
djblets.datagrid.grids.StatefulColumn) – The column state.queryset (
django.db.models.query.QuerySet) – The queryset to augment.
- Returns:
The resulting queryset.
- Return type:
- render_data(state: StatefulColumn, obj: ReviewRequest) SafeString[source]¶
Return the rendered contents of the column.
- Parameters:
state (
djblets.datagrid.grids.StatefulColumn) – The state for the datagrid.obj (
reviewboard.reviews.models.review_request.ReviewRequest) – The review request.
- Returns:
The rendered HTML.
- Return type:
- get_raw_object_value(state: StatefulColumn, obj: ReviewRequest) Sequence[Group][source]¶
Return the list of review groups.
New in version 7.1.
- Parameters:
state (
djblets.datagrids.grids.StatefulColumn) – The state for the DataGrid instance.obj (
reviewboard.reviews.models.ReviewRequest) – The review request to return the value for.
- Returns:
The list of review groups.
- Return type:
- class MyCommentsColumn(label: Optional[StrOrPromise] = None, id: Optional[str] = None, detailed_label: Optional[StrOrPromise] = None, detailed_label_html: Optional[str] = None, field_name: Optional[str] = None, db_field: Optional[str] = None, image_url: Optional[str] = None, image_class: Optional[str] = None, image_width: Optional[int] = None, image_height: Optional[int] = None, image_alt: Optional[str] = '', shrink: bool = False, expand: bool = False, sortable: bool = False, default_sort_dir: int = 0, link: bool = False, link_func: Optional[LinkObjectFunc] = None, link_css_class: Optional[Union[str, LinkCSSClassFunc]] = None, cell_clickable: bool = False, css_class: Union[str, BuildCSSClassFunc] = '')[source]¶
Bases:
ColumnShows if the current user has reviewed the review request.
- detailed_label: Optional[StrOrPromise] = 'My Comments'[source]¶
A detailed label to display in the Edit Columns menu.
Defaults to
label.- Type:
- image_class: Optional[str] = 'rb-icon rb-icon-datagrid-comment-draft'[source]¶
The CSS spritesheet icon class to use in the header/navigation menu.
- Type:
- augment_queryset(state: StatefulColumn, queryset: QuerySet) QuerySet[source]¶
Add additional queries to the queryset.
This will add subqueries for determining whether there are posted reviews, draft reviews, or Ship It! reviews.
- Parameters:
state (
djblets.datagrid.grids.StatefulColumn) – The state for the DataGrid instance.queryset (
django.db.models.query.QuerySet) – The queryset to augment.
- Returns:
The resulting augmented QuerySet.
- Return type:
- render_data(state: StatefulColumn, obj: ReviewRequest) SafeString[source]¶
Return the rendered contents of the column.
- Parameters:
state (
djblets.datagrids.grids.StatefulColumn) – The state for the DataGrid instance.obj (
reviewboard.reviews.models.ReviewRequest) – The review request being rendered for this row.
- get_raw_object_value(state: StatefulColumn, obj: ReviewRequest) Mapping[str, Any][source]¶
Return the raw value for review status.
New in version 7.1.
- Parameters:
state (
djblets.datagrids.grids.StatefulColumn) – The state for the DataGrid instance.obj (
reviewboard.reviews.models.ReviewRequest) – The review request for the row.
- Returns:
Information on the review status.
- Return type:
- class NewUpdatesColumn(label: Optional[StrOrPromise] = None, id: Optional[str] = None, detailed_label: Optional[StrOrPromise] = None, detailed_label_html: Optional[str] = None, field_name: Optional[str] = None, db_field: Optional[str] = None, image_url: Optional[str] = None, image_class: Optional[str] = None, image_width: Optional[int] = None, image_height: Optional[int] = None, image_alt: Optional[str] = '', shrink: bool = False, expand: bool = False, sortable: bool = False, default_sort_dir: int = 0, link: bool = False, link_func: Optional[LinkObjectFunc] = None, link_css_class: Optional[Union[str, LinkCSSClassFunc]] = None, cell_clickable: bool = False, css_class: Union[str, BuildCSSClassFunc] = '')[source]¶
Bases:
ColumnIndicates if there are new updates on a review request.
This will show an icon if the review request has had any new updates or reviews since the user last saw it.
- detailed_label: Optional[StrOrPromise] = 'New Updates'[source]¶
A detailed label to display in the Edit Columns menu.
Defaults to
label.- Type:
- image_class: Optional[str] = 'rb-icon rb-icon-new-updates'[source]¶
The CSS spritesheet icon class to use in the header/navigation menu.
- Type:
- render_data(state: StatefulColumn, obj: ReviewRequest) SafeString[source]¶
Return the rendered contents of the column.
- Parameters:
state (
djblets.datagrids.grids.StatefulColumn) – The state for the DataGrid instance.obj (
reviewboard.reviews.models.ReviewRequest) – The group or review request being rendered for this row.
- get_raw_object_value(state: StatefulColumn, obj: ReviewRequest) int[source]¶
Return the raw value for the new review count.
New in version 7.1.
- Parameters:
state (
djblets.datagrids.grids.StatefulColumn) – The state for the DataGrid instance.obj (
reviewboard.reviews.models.ReviewRequest) – The review request for the row.
- Returns:
The new review count for the review request.
- Return type:
- class PendingCountColumn(label: Optional[StrOrPromise] = None, id: Optional[str] = None, detailed_label: Optional[StrOrPromise] = None, detailed_label_html: Optional[str] = None, field_name: Optional[str] = None, db_field: Optional[str] = None, image_url: Optional[str] = None, image_class: Optional[str] = None, image_width: Optional[int] = None, image_height: Optional[int] = None, image_alt: Optional[str] = '', shrink: bool = False, expand: bool = False, sortable: bool = False, default_sort_dir: int = 0, link: bool = False, link_func: Optional[LinkObjectFunc] = None, link_css_class: Optional[Union[str, LinkCSSClassFunc]] = None, cell_clickable: bool = False, css_class: Union[str, BuildCSSClassFunc] = '')[source]¶
Bases:
ColumnShows the pending number of review requests for a user or group.
This will show the pending number of review requests for the given review group or user. It only applies to group or user lists.
- augment_queryset_for_data(state: StatefulColumn, queryset: QuerySet, **kwargs) QuerySet[source]¶
Augment a queryset for data-rendering purposes.
This will count the number of accessible open review requests.
New in version 5.0.7.
- Parameters:
state (
djblets.datagrid.grids.StatefulColumn) – The state for the DataGrid instance.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:
- render_data(state: StatefulColumn, obj: Group) SafeString[source]¶
Return the rendered contents of the column.
- Parameters:
state (
djblets.datagrid.grids.StatefulColumn) – The state for the datagrid.review_request (
reviewboard.reviews.models.review_request.ReviewRequest) – The review request.
- Returns:
The rendered HTML.
- Return type:
- get_raw_object_value(state: StatefulColumn, obj: Group) int[source]¶
Return the raw value for the pending review request count.
New in version 7.1.
- Parameters:
state (
djblets.datagrids.grids.StatefulColumn) – The state for the DataGrid instance.obj (
reviewboard.reviews.models.Group) – The review request for the row.
- Returns:
The pending review request count.
- Return type:
- class PeopleColumn(label: Optional[StrOrPromise] = None, id: Optional[str] = None, detailed_label: Optional[StrOrPromise] = None, detailed_label_html: Optional[str] = None, field_name: Optional[str] = None, db_field: Optional[str] = None, image_url: Optional[str] = None, image_class: Optional[str] = None, image_width: Optional[int] = None, image_height: Optional[int] = None, image_alt: Optional[str] = '', shrink: bool = False, expand: bool = False, sortable: bool = False, default_sort_dir: int = 0, link: bool = False, link_func: Optional[LinkObjectFunc] = None, link_css_class: Optional[Union[str, LinkCSSClassFunc]] = None, cell_clickable: bool = False, css_class: Union[str, BuildCSSClassFunc] = '')[source]¶
Bases:
ColumnShows the list of people requested to review the review request.
- detailed_label: Optional[StrOrPromise] = 'Target People'[source]¶
A detailed label to display in the Edit Columns menu.
Defaults to
label.- Type:
- shrink: bool = False[source]¶
Whether the column will shrink to the minimum size for the data.
- Type:
- augment_queryset(state: StatefulColumn, queryset: QuerySet) QuerySet[source]¶
Add additional queries to the queryset.
This will pre-fetch the reviewers for each review request.
- Parameters:
state (
djblets.datagrid.grids.StatefulColumn) – The column state.queryset (
django.db.models.query.QuerySet) – The queryset to augment.
- Returns:
The resulting queryset.
- Return type:
- render_data(state: StatefulColumn, obj: ReviewRequest) SafeString[source]¶
Return the rendered contents of the column.
- Parameters:
state (
djblets.datagrid.grids.StatefulColumn) – The state for the datagrid.obj (
reviewboard.reviews.models.review_request.ReviewRequest) – The review request.
- Returns:
The rendered HTML.
- Return type:
- get_raw_object_value(state: StatefulColumn, obj: ReviewRequest) Sequence[User][source]¶
Return the list of reviewers.
New in version 7.1.
- Parameters:
state (
djblets.datagrids.grids.StatefulColumn) – The state for the DataGrid instance.obj (
reviewboard.reviews.models.ReviewRequest) – The review request to return the value for.
- Returns:
The list of reviewers.
- Return type:
- class RepositoryColumn(label: Optional[StrOrPromise] = None, id: Optional[str] = None, detailed_label: Optional[StrOrPromise] = None, detailed_label_html: Optional[str] = None, field_name: Optional[str] = None, db_field: Optional[str] = None, image_url: Optional[str] = None, image_class: Optional[str] = None, image_width: Optional[int] = None, image_height: Optional[int] = None, image_alt: Optional[str] = '', shrink: bool = False, expand: bool = False, sortable: bool = False, default_sort_dir: int = 0, link: bool = False, link_func: Optional[LinkObjectFunc] = None, link_css_class: Optional[Union[str, LinkCSSClassFunc]] = None, cell_clickable: bool = False, css_class: Union[str, BuildCSSClassFunc] = '')[source]¶
Bases:
ColumnShows the name of the repository the review request’s change is on.
- field_name: str = 'repository'[source]¶
The name of the field on the model containing the data to render.
Once columns are populated for a datagrid, this is guaranteed to be set.
- Type:
- db_field: str = 'repository__name'[source]¶
The name of the database field containing the field used for sorting.
Once columns are populated for a datagrid, this is guaranteed to be set.
- Type:
- css_class: Union[str, BuildCSSClassFunc] = 'repository-column'[source]¶
A function or string for CSS classes applied to the cell.
- Type:
strorcallable
- link: bool = False[source]¶
Whether the contents of the cell will be linked to a URL.
The URL used must be defined by either
link_funcorDataGrid.link_to_object().- Type:
- augment_queryset(state: StatefulColumn, queryset: QuerySet) QuerySet[source]¶
Add additional queries to the queryset.
This will include the repository for each review request.
- Parameters:
state (
djblets.datagrid.grids.StatefulColumn) – The column state.queryset (
django.db.models.query.QuerySet) – The queryset to augment.
- Returns:
The resulting queryset.
- Return type:
- render_data(state: StatefulColumn, obj: ReviewRequest) SafeString[source]¶
Return the rendered contents of the column.
- Parameters:
state (
djblets.datagrid.grids.StatefulColumn) – The state for the datagrid.obj (
reviewboard.reviews.models.review_request.ReviewRequest) – The review request.
- Returns:
The rendered HTML.
- Return type:
- class ReviewCountColumn(label: Optional[StrOrPromise] = None, id: Optional[str] = None, detailed_label: Optional[StrOrPromise] = None, detailed_label_html: Optional[str] = None, field_name: Optional[str] = None, db_field: Optional[str] = None, image_url: Optional[str] = None, image_class: Optional[str] = None, image_width: Optional[int] = None, image_height: Optional[int] = None, image_alt: Optional[str] = '', shrink: bool = False, expand: bool = False, sortable: bool = False, default_sort_dir: int = 0, link: bool = False, link_func: Optional[LinkObjectFunc] = None, link_css_class: Optional[Union[str, LinkCSSClassFunc]] = None, cell_clickable: bool = False, css_class: Union[str, BuildCSSClassFunc] = '')[source]¶
Bases:
ColumnShows the number of published reviews for a review request.
- detailed_label: Optional[StrOrPromise] = 'Number of Reviews'[source]¶
A detailed label to display in the Edit Columns menu.
Defaults to
label.- Type:
- link: bool = True[source]¶
Whether the contents of the cell will be linked to a URL.
The URL used must be defined by either
link_funcorDataGrid.link_to_object().- Type:
- augment_queryset(state: StatefulColumn, queryset: QuerySet) QuerySet[source]¶
Add additional queries to the queryset.
This will perform a subquery to return a public review count for each review request.
- Parameters:
state (
djblets.datagrid.grids.StatefulColumn) – The column state.queryset (
django.db.models.query.QuerySet) – The queryset to augment.
- Returns:
The resulting queryset.
- Return type:
- render_data(state: StatefulColumn, obj: ReviewRequest) SafeString[source]¶
Return the rendered contents of the column.
- Parameters:
state (
djblets.datagrid.grids.StatefulColumn) – The state for the datagrid.obj (
reviewboard.reviews.models.review_request.ReviewRequest) – The review request.
- Returns:
The rendered HTML for the column.
- Return type:
- get_raw_object_value(state: StatefulColumn, obj: ReviewRequest) int[source]¶
Return the count value for the review request.
New in version 7.1.
- Parameters:
state (
djblets.datagrids.grids.StatefulColumn) – The state for the DataGrid instance.obj (
reviewboard.reviews.models.ReviewRequest) – The review request to return the value for.
- Returns:
The review count value.
- Return type:
- static link_func(state: StatefulColumn, obj: ReviewRequest, value: str) str[source]¶
Return the link to the object in the column.
- Parameters:
state (
djblets.datagrid.grids.StatefulColumn) – The column state.obj (
reviewboard.reviews.models.ReviewRequest) – The review request for the row.value (
str) – The rendered data.
- Returns:
The URL to link to.
- Return type:
- class ReviewGroupStarColumn(label: Optional[StrOrPromise] = None, id: Optional[str] = None, detailed_label: Optional[StrOrPromise] = None, detailed_label_html: Optional[str] = None, field_name: Optional[str] = None, db_field: Optional[str] = None, image_url: Optional[str] = None, image_class: Optional[str] = None, image_width: Optional[int] = None, image_height: Optional[int] = None, image_alt: Optional[str] = '', shrink: bool = False, expand: bool = False, sortable: bool = False, default_sort_dir: int = 0, link: bool = False, link_func: Optional[LinkObjectFunc] = None, link_css_class: Optional[Union[str, LinkCSSClassFunc]] = None, cell_clickable: bool = False, css_class: Union[str, BuildCSSClassFunc] = '')[source]¶
Bases:
BaseStarColumnIndicates if a review group is starred.
The star is interactive, allowing the user to star or unstar the group.
- class ReviewRequestIDColumn(label: Optional[StrOrPromise] = None, id: Optional[str] = None, detailed_label: Optional[StrOrPromise] = None, detailed_label_html: Optional[str] = None, field_name: Optional[str] = None, db_field: Optional[str] = None, image_url: Optional[str] = None, image_class: Optional[str] = None, image_width: Optional[int] = None, image_height: Optional[int] = None, image_alt: Optional[str] = '', shrink: bool = False, expand: bool = False, sortable: bool = False, default_sort_dir: int = 0, link: bool = False, link_func: Optional[LinkObjectFunc] = None, link_css_class: Optional[Union[str, LinkCSSClassFunc]] = None, cell_clickable: bool = False, css_class: Union[str, BuildCSSClassFunc] = '')[source]¶
Bases:
ColumnDisplays the ID of the review request.
- detailed_label: Optional[StrOrPromise] = 'Review Request ID'[source]¶
A detailed label to display in the Edit Columns menu.
Defaults to
label.- Type:
- field_name: str = 'display_id'[source]¶
The name of the field on the model containing the data to render.
Once columns are populated for a datagrid, this is guaranteed to be set.
- Type:
- class ReviewRequestStarColumn(label: Optional[StrOrPromise] = None, id: Optional[str] = None, detailed_label: Optional[StrOrPromise] = None, detailed_label_html: Optional[str] = None, field_name: Optional[str] = None, db_field: Optional[str] = None, image_url: Optional[str] = None, image_class: Optional[str] = None, image_width: Optional[int] = None, image_height: Optional[int] = None, image_alt: Optional[str] = '', shrink: bool = False, expand: bool = False, sortable: bool = False, default_sort_dir: int = 0, link: bool = False, link_func: Optional[LinkObjectFunc] = None, link_css_class: Optional[Union[str, LinkCSSClassFunc]] = None, cell_clickable: bool = False, css_class: Union[str, BuildCSSClassFunc] = '')[source]¶
Bases:
BaseStarColumnIndicates if a review request is starred.
The star is interactive, allowing the user to star or unstar the review request.
- starrable_model[source]¶
alias of
ReviewRequest
- class ShipItColumn(label: Optional[StrOrPromise] = None, id: Optional[str] = None, detailed_label: Optional[StrOrPromise] = None, detailed_label_html: Optional[str] = None, field_name: Optional[str] = None, db_field: Optional[str] = None, image_url: Optional[str] = None, image_class: Optional[str] = None, image_width: Optional[int] = None, image_height: Optional[int] = None, image_alt: Optional[str] = '', shrink: bool = False, expand: bool = False, sortable: bool = False, default_sort_dir: int = 0, link: bool = False, link_func: Optional[LinkObjectFunc] = None, link_css_class: Optional[Union[str, LinkCSSClassFunc]] = None, cell_clickable: bool = False, css_class: Union[str, BuildCSSClassFunc] = '')[source]¶
Bases:
ColumnShows the “Ship It” and issue counts for a review request.
If there are any issues still to resolve or verify, this will instead show information on those issues. Otherwise, it will show information on the number of Ship It! reviews filed.
The following is the order of priority in which information is shown:
Open issues with issues requiring verification
Open issues
Issues requiring verification
Ship It! counts
If showing a Ship It!, and if the latest review is older than the last update on the review request, the Ship It! will be marked as stale, helping visually indicate that it may need a re-review. The ARIA label reflects this as well.
Changed in version 5.0:
Added ARIA attributes for the displayed output.
Ship It! counts are now shown as stale if older than the latest update to the review request.
- detailed_label: Optional[StrOrPromise] = 'Ship It!/Issue Counts'[source]¶
A detailed label to display in the Edit Columns menu.
Defaults to
label.- Type:
- db_field: str = 'shipit_count'[source]¶
The name of the database field containing the field used for sorting.
Once columns are populated for a datagrid, this is guaranteed to be set.
- Type:
- image_class: Optional[str] = 'rb-icon rb-icon-datagrid-column-shipits-issues'[source]¶
The CSS spritesheet icon class to use in the header/navigation menu.
- Type:
- render_data(state: StatefulColumn, obj: ReviewRequest) SafeString[source]¶
Return the rendered contents of the column.
- Parameters:
state (
djblets.datagrid.grids.StatefulColumn) – The state for the datagrid.obj (
reviewboard.reviews.models.review_request.ReviewRequest) – The review request.
- Returns:
The rendered HTML for the column.
- Return type:
- get_raw_object_value(state: StatefulColumn, obj: ReviewRequest) Mapping[str, Any][source]¶
Return the summary and labels for a review request.
New in version 7.1.
- Parameters:
state (
djblets.datagrids.grids.StatefulColumn) – The state for the DataGrid instance.obj (
reviewboard.reviews.models.ReviewRequest) – The review request to calculate summary information for.
- Returns:
The summary and labels for the review request.
- Return type:
- class SummaryColumn(label: Optional[StrOrPromise] = None, id: Optional[str] = None, detailed_label: Optional[StrOrPromise] = None, detailed_label_html: Optional[str] = None, field_name: Optional[str] = None, db_field: Optional[str] = None, image_url: Optional[str] = None, image_class: Optional[str] = None, image_width: Optional[int] = None, image_height: Optional[int] = None, image_alt: Optional[str] = '', shrink: bool = False, expand: bool = False, sortable: bool = False, default_sort_dir: int = 0, link: bool = False, link_func: Optional[LinkObjectFunc] = None, link_css_class: Optional[Union[str, LinkCSSClassFunc]] = None, cell_clickable: bool = False, css_class: Union[str, BuildCSSClassFunc] = '')[source]¶
Bases:
ColumnShows the summary of a review request.
This will also prepend the draft/submitted/discarded state, if any, to the summary.
- css_class: Union[str, BuildCSSClassFunc] = 'summary'[source]¶
A function or string for CSS classes applied to the cell.
- Type:
strorcallable
- expand: bool = True[source]¶
Whether the column will expand to the maximum size allowed.
If there are other expanded columns, they’ll share the available width equally.
- Type:
- link: bool = True[source]¶
Whether the contents of the cell will be linked to a URL.
The URL used must be defined by either
link_funcorDataGrid.link_to_object().- Type:
- link_css_class: Optional[Union[str, LinkCSSClassFunc]] = 'review-request-link'[source]¶
A function or string for CSS classes applied to a link.
The CSS classes will be defined on the
<a>for the cell’s link wrapper. This is only used iflinkisTrue.- Type:
strorcallable
- augment_queryset(state: StatefulColumn, queryset: QuerySet) QuerySet[source]¶
Add additional queries to the queryset.
This will perform subqueries to retrieve draft summaries and archive/mute states for the review requests, in order to show labels before the summaries.
- Parameters:
state (
djblets.datagrid.grids.StatefulColumn) – The column state.queryset (
django.db.models.query.QuerySet) – The queryset to augment.
- Returns:
The resulting queryset.
- Return type:
- render_data(state: StatefulColumn, obj: ReviewRequest) SafeString[source]¶
Return the rendered contents of the column.
- Parameters:
state (
djblets.datagrid.grids.StatefulColumn) – The state for the datagrid.obj (
reviewboard.reviews.models.review_request.ReviewRequest) – The review request.
- Returns:
The rendered column.
- Return type:
- get_raw_object_value(state: StatefulColumn, obj: ReviewRequest) Mapping[str, Any][source]¶
Return the summary and labels for a review request.
New in version 7.1.
- Parameters:
state (
djblets.datagrids.grids.StatefulColumn) – The state for the DataGrid instance.obj (
reviewboard.reviews.models.ReviewRequest) – The review request to calculate summary information for.
- Returns:
The summary and labels for the review request.
- Return type:
- class ReviewSummaryColumn(label: Optional[StrOrPromise] = None, id: Optional[str] = None, detailed_label: Optional[StrOrPromise] = None, detailed_label_html: Optional[str] = None, field_name: Optional[str] = None, db_field: Optional[str] = None, image_url: Optional[str] = None, image_class: Optional[str] = None, image_width: Optional[int] = None, image_height: Optional[int] = None, image_alt: Optional[str] = '', shrink: bool = False, expand: bool = False, sortable: bool = False, default_sort_dir: int = 0, link: bool = False, link_func: Optional[LinkObjectFunc] = None, link_css_class: Optional[Union[str, LinkCSSClassFunc]] = None, cell_clickable: bool = False, css_class: Union[str, BuildCSSClassFunc] = '')[source]¶
Bases:
ColumnShows the summary of the review request of a review.
This does not (yet) prepend the draft/submitted/discarded state, if any, to the summary.
- label: Optional[StrOrPromise] = 'Review Request Summary'[source]¶
The label to show in the column header.
- Type:
- css_class: Union[str, BuildCSSClassFunc] = 'summary'[source]¶
A function or string for CSS classes applied to the cell.
- Type:
strorcallable
- expand: bool = True[source]¶
Whether the column will expand to the maximum size allowed.
If there are other expanded columns, they’ll share the available width equally.
- Type:
- link: bool = True[source]¶
Whether the contents of the cell will be linked to a URL.
The URL used must be defined by either
link_funcorDataGrid.link_to_object().- Type:
- link_css_class: Optional[Union[str, LinkCSSClassFunc]] = 'review-request-link'[source]¶
A function or string for CSS classes applied to a link.
The CSS classes will be defined on the
<a>for the cell’s link wrapper. This is only used iflinkisTrue.- Type:
strorcallable
- augment_queryset(state: StatefulColumn, queryset: QuerySet) QuerySet[source]¶
Add additional queries to the queryset.
This will load the review requests along with each review.
- Parameters:
state (
djblets.datagrid.grids.StatefulColumn) – The column state.queryset (
django.db.models.query.QuerySet) – The queryset to augment.
- Returns:
The resulting queryset.
- Return type:
- get_raw_object_value(state: StatefulColumn, obj: Review) str[source]¶
Return the raw value for review summary.
This will fetch the summary from the associated review request.
New in version 7.1.
- Parameters:
state (
djblets.datagrids.grids.StatefulColumn) – The state for the DataGrid instance.obj (
reviewboard.reviews.models.Review) – The review being rendered.
- Returns:
The summary of the associated review request.
- Return type:
- class ToMeColumn(label: Optional[StrOrPromise] = None, id: Optional[str] = None, detailed_label: Optional[StrOrPromise] = None, detailed_label_html: Optional[str] = None, field_name: Optional[str] = None, db_field: Optional[str] = None, image_url: Optional[str] = None, image_class: Optional[str] = None, image_width: Optional[int] = None, image_height: Optional[int] = None, image_alt: Optional[str] = '', shrink: bool = False, expand: bool = False, sortable: bool = False, default_sort_dir: int = 0, link: bool = False, link_func: Optional[LinkObjectFunc] = None, link_css_class: Optional[Union[str, LinkCSSClassFunc]] = None, cell_clickable: bool = False, css_class: Union[str, BuildCSSClassFunc] = '')[source]¶
Bases:
ColumnIndicates if the user is requested to review the change.
This will show an indicator if the user is on the Target People reviewers list.
- detailed_label: Optional[StrOrPromise] = 'To Me'[source]¶
A detailed label to display in the Edit Columns menu.
Defaults to
label.- Type:
- detailed_label_html: Optional[StrOrPromise] = '» To Me'[source]¶
A detailed label in HTML form to display in the Edit Columns menu.
This takes precedence over
detailed_label.- Type:
- augment_queryset(state: StatefulColumn, queryset: QuerySet) QuerySet[source]¶
Add additional queries to the queryset.
This will load the PKs of the review requests directed to the user and store them as state on the column for rendering.
- Parameters:
state (
djblets.datagrid.grids.StatefulColumn) – The column state.queryset (
django.db.models.query.QuerySet) – The queryset to augment.
- Returns:
The resulting queryset.
- Return type:
- render_data(state: StatefulColumn, obj: ReviewRequest) SafeString[source]¶
Return the rendered contents of the column.
If the object was directed to the user, an indicator will be shown.
- Parameters:
state (
djblets.datagrids.grids.StatefulColumn) – The state for the DataGrid instance.obj (
reviewboard.reviews.models.ReviewRequest) – The review request the column applies to.
- Returns:
The rendered HTML.
- Return type:
- get_raw_object_value(state: StatefulColumn, obj: ReviewRequest) bool[source]¶
Return the “to me” state as a boolean.
New in version 7.1.
- Parameters:
state (
djblets.datagrids.grids.StatefulColumn) – The state for the DataGrid instance.obj (
reviewboard.reviews.models.ReviewRequest) – The review request for the row.
- Returns:
Trueif the column was directed to the user.Falseif it was not.- Return type:
- class DiffSizeColumn(label: Optional[StrOrPromise] = None, id: Optional[str] = None, detailed_label: Optional[StrOrPromise] = None, detailed_label_html: Optional[str] = None, field_name: Optional[str] = None, db_field: Optional[str] = None, image_url: Optional[str] = None, image_class: Optional[str] = None, image_width: Optional[int] = None, image_height: Optional[int] = None, image_alt: Optional[str] = '', shrink: bool = False, expand: bool = False, sortable: bool = False, default_sort_dir: int = 0, link: bool = False, link_func: Optional[LinkObjectFunc] = None, link_css_class: Optional[Union[str, LinkCSSClassFunc]] = None, cell_clickable: bool = False, css_class: Union[str, BuildCSSClassFunc] = '')[source]¶
Bases:
ColumnIndicates line add/delete counts for the latest diffset.
- render_data(state: StatefulColumn, obj: ReviewRequest) SafeString[source]¶
Return the rendered contents of the column.
This will format HTML showing the diff’s insert and delete line counts.
- Parameters:
state (
djblets.datagrids.grids.StatefulColumn) – The state for the DataGrid instance.obj (
reviewboard.reviews.models.ReviewRequest) – The review request the column applies to.
- Returns:
The rendered HTML.
- Return type:
- get_raw_object_value(state: StatefulColumn, obj: ReviewRequest) Mapping[str, int] | None[source]¶
Return the raw value for the diff size information.
This will return the line count information for the diffset.
New in version 7.1.
- Parameters:
state (
djblets.datagrids.grids.StatefulColumn) – The state for the DataGrid instance.obj (
reviewboard.reviews.models.ReviewRequest) – The review request for the row.
- Returns:
The list of diff size information.
- Return type:
- augment_queryset(state: StatefulColumn, queryset: QuerySet) QuerySet[source]¶
Add additional queries to the queryset.
This will prefetch the diffsets and filediffs needed to perform the line calculations.
- Parameters:
state (
djblets.datagrid.grids.StatefulColumn) – The column state.queryset (
django.db.models.query.QuerySet) – The queryset to augment.
- Returns:
The resulting queryset.
- Return type: