reviewboard.admin.form_widgets¶
Admin-specific form widgets.
- class RelatedObjectWidget(local_site_name: Optional[str] = None, multivalued: bool = True, **kwargs)[source]¶
Bases:
RelatedObjectWidget
A base class form widget that lets people select one or more objects.
This is a base class. Extended classes must define their own render() method, to render their own widget with their own data.
This should be used with relatedObjectSelectorView.es6.js, which extends a Backbone view to display data.
- __init__(local_site_name: Optional[str] = None, multivalued: bool = True, **kwargs) None [source]¶
Initialize the widget.
- __annotations__ = {'local_site_name': 'Optional[str]'}¶
- class RelatedUserWidget(local_site_name: Optional[str] = None, multivalued: bool = True, **kwargs)[source]¶
Bases:
RelatedObjectWidget
A form widget to allow people to select one or more User relations.
It’s not unheard of to have a server with thousands or tens of thousands of registered users. In this case, the existing Django admin widgets fall down hard. The filtered select widgets can actually crash the webserver due to trying to pre-populate an enormous
<select>
element, and the raw ID widget is basically a write-only field.This field does much better, offering both the ability to see who’s already in the list, as well as interactive search and filtering.
- render(name, value, attrs=None, renderer=None)[source]¶
Render the widget.
- Parameters:
- Returns:
The rendered HTML.
- Return type:
django.utils.safestring.SafeText
- __annotations__ = {}¶
- __slotnames__ = []¶
- class RelatedRepositoryWidget(*args, show_invisible: bool = True, **kwargs)[source]¶
Bases:
RelatedObjectWidget
A form widget allowing people to select one or more Repository objects.
This widget offers both the ability to see which repositories are already in the list, as well as interactive search and filtering.
- __init__(*args, show_invisible: bool = True, **kwargs) None [source]¶
Initialize the RelatedGroupWidget.
Changed in version 5.0.6: Added the
show_invisible
argument.
- show_invisible: bool¶
Whether to include accessible invisible repositories in the results.
New in version 5.0.6.
- render(name: str, value: Any, attrs: Optional[Dict[str, Any]] = None, renderer: Optional[BaseRenderer] = None) SafeString [source]¶
Render the widget.
- Parameters:
- Returns:
The rendered HTML.
- Return type:
django.utils.safestring.SafeText
- value_from_datadict(data, files, name)[source]¶
Unpack the field’s value from a datadict.
- Parameters:
- Returns:
The list of IDs of
Repository
objects.- Return type:
- __annotations__ = {'local_site_name': 'Optional[str]', 'show_invisible': 'bool'}¶
- __slotnames__ = []¶
- class RelatedGroupWidget(invite_only: bool = False, *args, show_invisible: bool = True, **kwargs)[source]¶
Bases:
RelatedObjectWidget
A form widget allowing people to select one or more Group objects.
This widget offers both the ability to see which groups are already in the list, as well as interactive search and filtering.
Changed in version 5.0.6:
Added an option for enabling specifying invisible review groups.
Added support for Python type hints.
- __init__(invite_only: bool = False, *args, show_invisible: bool = True, **kwargs) None [source]¶
Initialize the RelatedGroupWidget.
Changed in version 5.0.6: Added the
show_invisible
argument.- Parameters:
invite_only (
bool
, optional) – Whether or not to limit results to accessible review groups that are invite-only.show_invisible (
bool
, optional) –Whether to include accessible invisible review groups in the results.
This is the default.
New in version 5.0.6.
*args (
tuple
) – Positional arguments to pass to the handler.**kwargs (
dict
) – Keyword arguments to pass to the handler.
- show_invisible: bool¶
Whether or not to limit review groups to ones that are visible.
New in version 5.0.6.
- render(name: str, value: Any, attrs: Optional[Dict[str, Any]] = None, renderer: Optional[BaseRenderer] = None) SafeString [source]¶
Render the widget.
- Parameters:
- Returns:
The rendered HTML.
- Return type:
django.utils.safestring.SafeText
- __annotations__ = {'invite_only': 'bool', 'local_site_name': 'Optional[str]', 'show_invisible': 'bool'}¶
- __slotnames__ = []¶
- class LexersMappingWidget(attrs=None)[source]¶
Bases:
MultiWidget
A form widget for mapping a string to a Pygments Lexer class.
This widget displays a text input with a drop-down list of Pygments Lexer names next to it.
New in version 5.0.
- __annotations__ = {}¶
- __init__(attrs=None)[source]¶
Initialize the LexersMappingWidget.
- Parameters:
attrs (
dict
, optional) – A dictionary containing HTML attributes to be set on the rendered widget.