Rename WebhooksMixin to EventRulesMixin

This commit is contained in:
Jeremy Stretch 2023-11-28 08:16:28 -05:00
parent f860345914
commit 267b5a1b3a
6 changed files with 16 additions and 13 deletions

View File

@ -22,7 +22,7 @@ Depending on its classification, each NetBox model may support various features
| [Journaling](../features/journaling.md) | `JournalingMixin` | `journaling` | These models support persistent historical commentary |
| [Synchronized data](../integrations/synchronized-data.md) | `SyncedDataMixin` | `synced_data` | Certain model data can be automatically synchronized from a remote data source |
| [Tagging](../models/extras/tag.md) | `TagsMixin` | `tags` | The models can be tagged with user-defined tags |
| [Webhooks](../integrations/webhooks.md) | `WebhooksMixin` | `webhooks` | NetBox is capable of generating outgoing webhooks for these objects |
| [Webhooks](../integrations/webhooks.md) | `EventRulesMixin` | `webhooks` | NetBox is capable of generating outgoing webhooks for these objects |
## Models Index

View File

@ -119,14 +119,17 @@ For more information about database migrations, see the [Django documentation](h
::: netbox.models.features.CustomValidationMixin
::: netbox.models.features.EventRulesMixin
!!! note
`EventRulesMixin` was renamed from `WebhooksMixin` in NetBox v3.7.
::: netbox.models.features.ExportTemplatesMixin
::: netbox.models.features.JournalingMixin
::: netbox.models.features.TagsMixin
::: netbox.models.features.WebhooksMixin
## Choice Sets
For model fields which support the selection of one or more values from a predefined list of choices, NetBox provides the `ChoiceSet` utility class. This can be used in place of a regular choices tuple to provide enhanced functionality, namely dynamic configuration and colorization. (See [Django's documentation](https://docs.djangoproject.com/en/stable/ref/models/fields/#choices) on the `choices` parameter for supported model fields.)

View File

@ -9,7 +9,7 @@ from django.utils.translation import gettext_lazy as _
from core.choices import ManagedFileRootPathChoices
from core.models import ManagedFile
from extras.utils import is_report
from netbox.models.features import JobsMixin, WebhooksMixin
from netbox.models.features import JobsMixin, EventRulesMixin
from utilities.querysets import RestrictedQuerySet
from .mixins import PythonModuleMixin
@ -21,7 +21,7 @@ __all__ = (
)
class Report(WebhooksMixin, models.Model):
class Report(EventRulesMixin, models.Model):
"""
Dummy model used to generate permissions for reports. Does not exist in the database.
"""

View File

@ -9,7 +9,7 @@ from django.utils.translation import gettext_lazy as _
from core.choices import ManagedFileRootPathChoices
from core.models import ManagedFile
from extras.utils import is_script
from netbox.models.features import JobsMixin, WebhooksMixin
from netbox.models.features import JobsMixin, EventRulesMixin
from utilities.querysets import RestrictedQuerySet
from .mixins import PythonModuleMixin
@ -21,7 +21,7 @@ __all__ = (
logger = logging.getLogger('netbox.data_backends')
class Script(WebhooksMixin, models.Model):
class Script(EventRulesMixin, models.Model):
"""
Dummy model used to generate permissions for custom scripts. Does not exist in the database.
"""

View File

@ -30,7 +30,7 @@ class NetBoxFeatureSet(
ExportTemplatesMixin,
JournalingMixin,
TagsMixin,
WebhooksMixin
EventRulesMixin
):
class Meta:
abstract = True
@ -44,7 +44,7 @@ class NetBoxFeatureSet(
# Base model classes
#
class ChangeLoggedModel(ChangeLoggingMixin, CustomValidationMixin, WebhooksMixin, models.Model):
class ChangeLoggedModel(ChangeLoggingMixin, CustomValidationMixin, EventRulesMixin, models.Model):
"""
Base model for ancillary models; provides limited functionality for models which don't
support NetBox's full feature set.

View File

@ -35,7 +35,7 @@ __all__ = (
'JournalingMixin',
'SyncedDataMixin',
'TagsMixin',
'WebhooksMixin',
'EventRulesMixin',
)
@ -400,9 +400,9 @@ class TagsMixin(models.Model):
abstract = True
class WebhooksMixin(models.Model):
class EventRulesMixin(models.Model):
"""
Enables support for webhooks.
Enables support for event rules, which can be used to transmit webhooks or execute scripts automatically.
"""
class Meta:
abstract = True
@ -555,7 +555,7 @@ FEATURES_MAP = {
'journaling': JournalingMixin,
'synced_data': SyncedDataMixin,
'tags': TagsMixin,
'webhooks': WebhooksMixin,
'webhooks': EventRulesMixin,
}
registry['model_features'].update({