Jump to >

reviewboard.admin.form_widgets

Admin-specific form widgets.

class RelatedObjectWidget(local_site_name=None, multivalued=True)[source]

Bases: djblets.forms.widgets.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=None, multivalued=True)[source]
class RelatedUserWidget(local_site_name=None, multivalued=True)[source]

Bases: reviewboard.admin.form_widgets.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)[source]

Render the widget.

Parameters:
  • name (unicode) – The name of the field.
  • value (list) – The current value of the field.
  • attrs (dict, optional) – Attributes for the HTML element.
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:
  • data (dict) – The form’s data.
  • files (dict) – The form’s files.
  • name (unicode) – The name of the field.
Returns:

The list of PKs of User objects.

Return type:

list

__slotnames__ = [][source]
class RelatedRepositoryWidget(local_site_name=None, multivalued=True)[source]

Bases: reviewboard.admin.form_widgets.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.

render(name, value, attrs=None)[source]

Render the widget.

Parameters:
  • name (unicode) – The name of the field.
  • value (list) – The current value of the field.
  • attrs (dict, optional) – Attributes for the HTML element.
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:
  • data (dict) – The form’s data.
  • files (dict) – The form’s files.
  • name (unicode) – The name of the field.
Returns:

The list of IDs of Repository objects.

Return type:

list

__slotnames__ = [][source]
class RelatedGroupWidget(invite_only=False, *args, **kwargs)[source]

Bases: reviewboard.admin.form_widgets.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.

__init__(invite_only=False, *args, **kwargs)[source]

Initialize the RelatedGroupWidget.

Parameters:
  • invite_only (bool, optional) – Whether or not to display groups that are invite-only.
  • *args (tuple) – Positional arguments to pass to the handler.
  • **kwargs (dict) – Keyword arguments to pass to the handler.
render(name, value, attrs=None)[source]

Render the widget.

Parameters:
  • name (unicode) – The name of the field.
  • value (list) – The current value of the field.
  • attrs (dict, optional) – Attributes for the HTML element.
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:
  • data (dict) – The form’s data.
  • files (dict) – The form’s files.
  • name (unicode) – The name of the field.
Returns:

The list of PKs of Group objects.

Return type:

list

__slotnames__ = [][source]