#16886: Updated documentation for event types
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
# Events
|
||||
# Event Types
|
||||
|
||||
Plugins can register their own custom event types for use with NetBox [event rules](../../models/extras/eventrule.md). This is accomplished by calling the `register()` method on an instance of the `Event` class. This can be done anywhere within the plugin. An example is provided below.
|
||||
!!! info "This feature was introduced in NetBox v4.1."
|
||||
|
||||
Plugins can register their own custom event types for use with NetBox [event rules](../../models/extras/eventrule.md). This is accomplished by calling the `register()` method on an instance of the `EventType` class. This can be done anywhere within the plugin. An example is provided below.
|
||||
|
||||
```python
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
@@ -9,8 +11,8 @@ from netbox.events import EventType, EVENT_TYPE_KIND_SUCCESS
|
||||
EventType(
|
||||
name='ticket_opened',
|
||||
text=_('Ticket opened'),
|
||||
type=EVENT_TYPE_KIND_SUCCESS
|
||||
kind=EVENT_TYPE_KIND_SUCCESS
|
||||
).register()
|
||||
```
|
||||
|
||||
::: netbox.events.Event
|
||||
::: netbox.events.EventType
|
Reference in New Issue
Block a user