Switches are simple booleans: they are on or off, for everyone, all the time. They do not require a request object and can be used in other contexts, such as management commands and tasks.

Switch Attributes

Switches can be administered through the Django admin site or the command line. They have the following attributes:

Name:The name of the Switch.
Active:Is the Switch active or inactive.
Note:Describe where the Switch is used.

Auto Create Missing

When a switch is evaluated in code that is missing in the database the switch returns the WAFFLE_SWITCH_DEFAULT value but does not create a switch in the database. If you’d like waffle to create missing switches in the database whenever it encounters a missing switch you can set WAFFLE_CREATE_MISSING_SWITCHES to True. Missing switches will be created in the database and the value of the Active switch attribute will be set to WAFFLE_SWITCH_DEFAULT in the auto-created database record.

Log Missing

Whether or not you enabled Auto Create Missing Switch, it can be practical to be informed that a switch was or is missing. If you’d like waffle to log a warning, error, … you can set WAFFLE_LOG_MISSING_FLAGS to any level known by Python default logger.