mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-25 08:46:10 -06:00
Documentation updates
This commit is contained in:
parent
f67b63b539
commit
08193e47a7
@ -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)
|
||||||
|
@ -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:
|
||||||
|
Loading…
Reference in New Issue
Block a user