Documentation updates

This commit is contained in:
jeremystretch 2022-10-21 08:31:58 -04:00
parent f67b63b539
commit 08193e47a7
2 changed files with 15 additions and 8 deletions

View File

@ -157,6 +157,14 @@ The file path to the location where [custom scripts](../customization/custom-scr
--- ---
## SEARCH_BACKEND
Default: `'netbox.search.backends.CachedValueSearchBackend'`
The dotted path to the desired search backend class. `CachedValueSearchBackend` is currently the only search backend provided in NetBox, however this setting can be used to enable a custom backend.
---
## STORAGE_BACKEND ## STORAGE_BACKEND
Default: None (local storage) Default: None (local storage)

View File

@ -4,17 +4,16 @@ Plugins can define and register their own models to extend NetBox's core search
```python ```python
# search.py # search.py
from netbox.search import SearchMixin from netbox.search import SearchIndex
from .filters import MyModelFilterSet
from .tables import MyModelTable
from .models import MyModel from .models import MyModel
class MyModelIndex(SearchMixin): class MyModelIndex(SearchIndex):
model = MyModel model = MyModel
queryset = MyModel.objects.all() fields = (
filterset = MyModelFilterSet ('name', 100),
table = MyModelTable ('description', 500),
url = 'plugins:myplugin:mymodel_list' ('comments', 5000),
)
``` ```
To register one or more indexes with NetBox, define a list named `indexes` at the end of this file: To register one or more indexes with NetBox, define a list named `indexes` at the end of this file: