mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-23 04:22:01 -06:00
Standardize import statement as django_rq is no longer optional
This commit is contained in:
parent
d8cb58c746
commit
4971054c34
@ -3,11 +3,11 @@ import hmac
|
|||||||
|
|
||||||
from django.contrib.contenttypes.models import ContentType
|
from django.contrib.contenttypes.models import ContentType
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
|
from django_rq import get_queue
|
||||||
|
|
||||||
from extras.models import Webhook
|
from extras.models import Webhook
|
||||||
from utilities.api import get_serializer_for_model
|
from utilities.api import get_serializer_for_model
|
||||||
from .choices import *
|
from .choices import *
|
||||||
from .constants import *
|
|
||||||
from .utils import FeatureQuery
|
from .utils import FeatureQuery
|
||||||
|
|
||||||
|
|
||||||
@ -50,12 +50,8 @@ def enqueue_webhooks(instance, user, request_id, action):
|
|||||||
}
|
}
|
||||||
serializer = serializer_class(instance, context=serializer_context)
|
serializer = serializer_class(instance, context=serializer_context)
|
||||||
|
|
||||||
# We must only import django_rq if the Webhooks feature is enabled.
|
# Enqueue the webhooks
|
||||||
# Only if we have gotten to ths point, is the feature enabled
|
|
||||||
from django_rq import get_queue
|
|
||||||
webhook_queue = get_queue('default')
|
webhook_queue = get_queue('default')
|
||||||
|
|
||||||
# enqueue the webhooks:
|
|
||||||
for webhook in webhooks:
|
for webhook in webhooks:
|
||||||
webhook_queue.enqueue(
|
webhook_queue.enqueue(
|
||||||
"extras.webhooks_worker.process_webhook",
|
"extras.webhooks_worker.process_webhook",
|
||||||
|
Loading…
Reference in New Issue
Block a user