Skip to main content
Parameter option for single-select and multi-select parameters. This class can be imported from the squirrels.parameter_options or the squirrels module.

Constructor

Creates a SelectParameterOption object. Typically used in pyconfigs/parameters.py.

Examples

A SelectParameterOption object is created in the pyconfigs/parameters.py file. It must be created in a function decorated with the create_with_options or create_simple factory method from SingleSelectParameter or MultiSelectParameter.

Usage example in parameters.py

In addition, the following are some additional examples for creating a SelectParameterOption object.

Using custom fields

This example adds custom attributes to parameter options that can be accessed in context.py or the data models directly. Custom fields can be provided as keyword arguments or in the custom_fields dictionary.

Setting up cascading parameters with parent options

This example shows how to create child options that are only visible when specific parent options are selected. The parent_option_ids field controls this behavior.

Restricting visibility by user groups

This example shows how to restrict certain options to specific user access levels using the user_groups parameter.
If custom user fields are defined in pyconfigs/user.py, then they can be used to restrict visibility of parameter options as well. To do so, the user_attribute argument must be prefixed with custom_fields..