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

Closes #4711: Rename Webhook.obj_type to content_types

This commit is contained in:
Jeremy Stretch
2020-12-02 14:49:07 -05:00
parent f5133c6737
commit ba00d57d37
6 changed files with 31 additions and 10 deletions

View File

@ -35,13 +35,13 @@ def enqueue_webhooks(instance, user, request_id, action):
return
# Retrieve any applicable Webhooks
obj_type = ContentType.objects.get_for_model(instance)
content_type = ContentType.objects.get_for_model(instance)
action_flag = {
ObjectChangeActionChoices.ACTION_CREATE: 'type_create',
ObjectChangeActionChoices.ACTION_UPDATE: 'type_update',
ObjectChangeActionChoices.ACTION_DELETE: 'type_delete',
}[action]
webhooks = Webhook.objects.filter(obj_type=obj_type, enabled=True, **{action_flag: True})
webhooks = Webhook.objects.filter(content_types=content_type, enabled=True, **{action_flag: True})
if webhooks.exists():
# Get the Model's API serializer class and serialize the object