Update documentation for FIELD_CHOICES

This commit is contained in:
jeremystretch 2021-12-28 20:21:35 -05:00
parent b3ea007e0a
commit b60ace80be

View File

@ -161,16 +161,16 @@ EXEMPT_VIEW_PERMISSIONS = ['*']
Default: Empty dictionary
Some static choice fields on models can be configured with custom values. This is done by defining `FIELD_CHOICES` as a dictionary mapping model fields to their choices list. Each choice in the list must have a database value and a human-friendly label, and may optionally specify a color.
Some static choice fields on models can be configured with custom values. This is done by defining `FIELD_CHOICES` as a dictionary mapping model fields to their choices list. Each choice in the list must have a database value and a human-friendly label, and may optionally specify a color. (A list of available colors is provided below.)
For example, to specify a custom set of choices for the site status field:
```python
FIELD_CHOICES = {
'dcim.Site.status': (
('foo', 'Foo'),
('bar', 'Bar'),
('baz', 'Baz'),
('foo', 'Foo', 'red'),
('bar', 'Bar', 'green'),
('baz', 'Baz', 'blue'),
)
}
```
@ -190,6 +190,22 @@ The following model field support configurable choices:
* `ipam.VLAN.status`
* `virtualization.VirtualMachine.status`
The following colors are supported:
* `blue`
* `indigo`
* `purple`
* `pink`
* `red`
* `orange`
* `yellow`
* `green`
* `teal`
* `cyan`
* `gray`
* `black`
* `white`
---
## HTTP_PROXIES