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 89ec24caa2
commit 030909261d
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