reviewboard.reviews.views.diffviewer¶
Diff viewer view.
- class ReviewsDiffViewerView(**kwargs)[source]¶
Bases:
ReviewRequestViewMixin
,UserProfileRequiredViewMixin
,DiffViewerView
Renders the diff viewer for a review request.
This wraps the base
DiffViewerView
to display a diff for the given review request and the given diff revision or range.The view expects the following parameters to be provided:
review_request_id
:The ID of the ReviewRequest containing the diff to render.
The following may also be provided:
revision
:The DiffSet revision to render.
interdiff_revision
:The second DiffSet revision in an interdiff revision range.
local_site
:The LocalSite the ReviewRequest must be on, if any.
See
DiffViewerView
’s documentation for the accepted query parameters.- __init__(**kwargs) None [source]¶
Initialize a view for the request.
- Parameters:
**kwargs (
dict
) – Keyword arguments passed toas_view()
.
- get(request: HttpRequest, revision: Optional[int] = None, interdiff_revision: Optional[int] = None, *args, **kwargs) HttpResponse [source]¶
Handle HTTP GET requests for this view.
This will look up the review request and DiffSets, given the provided information, and pass them to the parent class for rendering.
- Parameters:
request (
django.http.HttpRequest
) – The HTTP request from the client.revision (
int
, optional) – The revision of the diff to view. This defaults to the latest diff.interdiff_revision (
int
, optional) – The revision to use for an interdiff, if viewing an interdiff.*args (
tuple
) – Positional arguments passed to the handler.**kwargs (
dict
) – Keyword arguments passed to the handler.
- Returns:
The HTTP response to send to the client.
- Return type:
- get_context_data(**kwargs) Dict[str, Any] [source]¶
Return additional context data for the template.
This provides some additional data used for rendering the diff viewer. This data is more specific to the reviewing functionality, as opposed to the data calculated by
DiffViewerView.get_context_data
which is more focused on the actual diff.
- __annotations__ = {}¶