mirror of
https://github.com/netbox-community/netbox.git
synced 2025-12-21 12:52:21 -06:00
* merge branch develop * bugfix, signals for virtualization's class wasn't correctly defined * updated webhooks for 2.4 and cleanup * updated docs to cover changes to supervisor config * review changes and further cleanup * updated redis connection settings * cleanup settings
This commit is contained in:
committed by
Jeremy Stretch
parent
4fd52d46bf
commit
836478c166
@@ -71,3 +71,14 @@ def foreground_color(bg_color):
|
||||
return '000000'
|
||||
else:
|
||||
return 'ffffff'
|
||||
|
||||
|
||||
def dynamic_import(name):
|
||||
"""
|
||||
Dynamically import a class from an absolute path string
|
||||
"""
|
||||
components = name.split('.')
|
||||
mod = __import__(components[0])
|
||||
for comp in components[1:]:
|
||||
mod = getattr(mod, comp)
|
||||
return mod
|
||||
|
||||
@@ -20,6 +20,7 @@ from django.views.generic import View
|
||||
from django_tables2 import RequestConfig
|
||||
|
||||
from extras.models import CustomField, CustomFieldValue, ExportTemplate, UserAction
|
||||
from extras.webhooks import bulk_operation_signal
|
||||
from utilities.utils import queryset_to_csv
|
||||
from utilities.forms import BootstrapMixin, CSVDataField
|
||||
from .constants import M2M_FIELD_TYPES
|
||||
@@ -772,6 +773,9 @@ class ComponentCreateView(View):
|
||||
field_links.append(field_link)
|
||||
getattr(self.model, field).through.objects.bulk_create(field_links)
|
||||
|
||||
# send the bulk operations signal for webhooks
|
||||
bulk_operation_signal.send(sender=self.model, instances=new_components, event="created")
|
||||
|
||||
messages.success(request, "Added {} {} to {}.".format(
|
||||
len(new_components), self.model._meta.verbose_name_plural, parent
|
||||
))
|
||||
@@ -848,6 +852,10 @@ class BulkComponentCreateView(View):
|
||||
|
||||
if not form.errors:
|
||||
self.model.objects.bulk_create(new_components)
|
||||
|
||||
# send the bulk operations signal for webhooks
|
||||
bulk_operation_signal.send(sender=self.model, instances=new_components, event="created")
|
||||
|
||||
messages.success(request, "Added {} {} to {} {}.".format(
|
||||
len(new_components),
|
||||
self.model._meta.verbose_name_plural,
|
||||
|
||||
Reference in New Issue
Block a user