1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Add step for creating search index

This commit is contained in:
jeremystretch
2023-02-07 16:55:50 -05:00
parent edbd597bf2
commit 3f28d6aef3

View File

@ -54,15 +54,19 @@ Each model should have a corresponding FilterSet class defined. This is used to
Create a table class for the model in `tables.py` by subclassing `utilities.tables.BaseTable`. Under the table's `Meta` class, be sure to list both the fields and default columns.
## 9. Create the object template
## 9. Create a SearchIndex subclass
If this model will be included in global search results, create a subclass of `netbox.search.SearchIndex` for it and specify the fields to be indexed.
## 10. Create the object template
Create the HTML template for the object view. (The other views each typically employ a generic template.) This template should extend `generic/object.html`.
## 10. Add the model to the navigation menu
## 11. Add the model to the navigation menu
Add the relevant navigation menu items in `netbox/netbox/navigation/menu.py`.
## 11. REST API components
## 12. REST API components
Create the following for each model:
@ -71,13 +75,13 @@ Create the following for each model:
* API view in `api/views.py`
* Endpoint route in `api/urls.py`
## 12. GraphQL API components
## 13. GraphQL API components
Create a Graphene object type for the model in `graphql/types.py` by subclassing the appropriate class from `netbox.graphql.types`.
Also extend the schema class defined in `graphql/schema.py` with the individual object and object list fields per the established convention.
## 13. Add tests
## 14. Add tests
Add tests for the following:
@ -85,7 +89,7 @@ Add tests for the following:
* API views
* Filter sets
## 14. Documentation
## 15. Documentation
Create a new documentation page for the model in `docs/models/<app_label>/<model_name>.md`. Include this file under the "features" documentation where appropriate.