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

Clean up, update Webhook models

This commit is contained in:
Jeremy Stretch
2019-04-17 14:19:57 -04:00
parent 000fde25c6
commit 2f3c39295c
4 changed files with 45 additions and 13 deletions

View File

@@ -26,6 +26,10 @@ from .querysets import ConfigContextQuerySet
# Webhooks
#
def get_webhook_models():
return model_names_to_filter_dict(WEBHOOK_MODELS)
class Webhook(models.Model):
"""
A Webhook defines a request that will be sent to a remote application when an object is created, updated, and/or
@@ -37,7 +41,7 @@ class Webhook(models.Model):
to=ContentType,
related_name='webhooks',
verbose_name='Object types',
limit_choices_to={'model__in': WEBHOOK_MODELS},
limit_choices_to=get_webhook_models,
help_text="The object(s) to which this Webhook applies."
)
name = models.CharField(