devices.widgetsΒΆ

This module contains widgets used in the devices app.

ClassesΒΆ

DisableSelectOptionsWidget

Allows to disable options within a select input.

Module ContentsΒΆ

class devices.widgets.DisableSelectOptionsWidget(disabled_values=None, *args, **kwargs)[source]ΒΆ

Bases: django.forms.Select

Allows to disable options within a select input.

Parameters:
  • disabled_values (list[str] | None)

  • args (Any)

  • kwargs (Any)

disabled_values: list[str][source]ΒΆ
create_option(name, value, *args, **kwargs)[source]ΒΆ

Creates the options in the select and disables the desired ones.

Parameters:
  • name (str) – The name of the option.

  • value (Any) – The value of the option.

  • *args (Any) – Positional arguments passed to forms.Select.create_option.

  • **kwargs (Any) – Positional arguments passed to forms.Select.create_option.

Returns:

The option dictionary.

Return type:

dict[str, Any]